Get rid of old settings.
I broke things with 795d243e9d because I
forgot to remove it everywhere from functions and templates. Also
removed the old PUPPETDB_EXPERIMENTAL switching.
This commit is contained in:
@@ -137,10 +137,7 @@ def node(node_name):
|
|||||||
"""
|
"""
|
||||||
node = get_or_abort(puppetdb.node, node_name)
|
node = get_or_abort(puppetdb.node, node_name)
|
||||||
facts = node.facts()
|
facts = node.facts()
|
||||||
if app.config['PUPPETDB_API'] > 2:
|
|
||||||
reports = ten_reports(node.reports())
|
reports = ten_reports(node.reports())
|
||||||
else:
|
|
||||||
reports = iter([])
|
|
||||||
return render_template('node.html', node=node, facts=yield_or_stop(facts),
|
return render_template('node.html', node=node, facts=yield_or_stop(facts),
|
||||||
reports=yield_or_stop(reports))
|
reports=yield_or_stop(reports))
|
||||||
|
|
||||||
@@ -148,22 +145,14 @@ def node(node_name):
|
|||||||
def reports():
|
def reports():
|
||||||
"""Doesn't do much yet but is meant to show something like the reports of
|
"""Doesn't do much yet but is meant to show something like the reports of
|
||||||
the last half our, something like that."""
|
the last half our, something like that."""
|
||||||
if app.config['PUPPETDB_API'] > 2:
|
|
||||||
return render_template('reports.html')
|
return render_template('reports.html')
|
||||||
else:
|
|
||||||
log.warn('PuppetDB API prior to v3 cannot access reports.')
|
|
||||||
abort(412)
|
|
||||||
|
|
||||||
@app.route('/reports/<node>')
|
@app.route('/reports/<node>')
|
||||||
def reports_node(node):
|
def reports_node(node):
|
||||||
"""Fetches all reports for a node and processes them eventually rendering
|
"""Fetches all reports for a node and processes them eventually rendering
|
||||||
a table displaying those reports."""
|
a table displaying those reports."""
|
||||||
if app.config['PUPPETDB_API'] > 2:
|
|
||||||
reports = ten_reports(yield_or_stop(
|
reports = ten_reports(yield_or_stop(
|
||||||
puppetdb.reports('["=", "certname", "{0}"]'.format(node))))
|
puppetdb.reports('["=", "certname", "{0}"]'.format(node))))
|
||||||
else:
|
|
||||||
log.warn('PuppetDB API prior to v3 cannot access reports.')
|
|
||||||
abort(412)
|
|
||||||
return render_template('reports_node.html', reports=reports,
|
return render_template('reports_node.html', reports=reports,
|
||||||
nodename=node)
|
nodename=node)
|
||||||
|
|
||||||
@@ -175,10 +164,7 @@ def report_latest(node_name):
|
|||||||
"""
|
"""
|
||||||
# TODO: use limit parameter in _query to get just one report
|
# TODO: use limit parameter in _query to get just one report
|
||||||
node = get_or_abort(puppetdb.node, node_name)
|
node = get_or_abort(puppetdb.node, node_name)
|
||||||
if app.config['PUPPETDB_API'] > 2:
|
|
||||||
reports = ten_reports(node.reports())
|
reports = ten_reports(node.reports())
|
||||||
else:
|
|
||||||
reports = iter([])
|
|
||||||
report = list(yield_or_stop(reports))[0]
|
report = list(yield_or_stop(reports))[0]
|
||||||
return redirect(url_for('report', node=node_name, report_id=report))
|
return redirect(url_for('report', node=node_name, report_id=report))
|
||||||
|
|
||||||
@@ -187,11 +173,7 @@ def report(node, report_id):
|
|||||||
"""Displays a single report including all the events associated with that
|
"""Displays a single report including all the events associated with that
|
||||||
report and their status.
|
report and their status.
|
||||||
"""
|
"""
|
||||||
if app.config['PUPPETDB_API'] > 2:
|
|
||||||
reports = puppetdb.reports('["=", "certname", "{0}"]'.format(node))
|
reports = puppetdb.reports('["=", "certname", "{0}"]'.format(node))
|
||||||
else:
|
|
||||||
log.warn('PuppetDB API prior to v3 cannot access reports.')
|
|
||||||
abort(412)
|
|
||||||
|
|
||||||
for report in reports:
|
for report in reports:
|
||||||
if report.hash_ == report_id:
|
if report.hash_ == report_id:
|
||||||
|
|||||||
@@ -18,16 +18,13 @@
|
|||||||
<td>Facts retrieved at</td>
|
<td>Facts retrieved at</td>
|
||||||
<td rel="utctimestamp">{{node.facts_timestamp}}</td>
|
<td rel="utctimestamp">{{node.facts_timestamp}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% if config.PUPPETDB_EXPERIMENTAL %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Report uploaded at</td>
|
<td>Report uploaded at</td>
|
||||||
<td rel="utctimestamp">{{node.report_timestamp}}</td>
|
<td rel="utctimestamp">{{node.report_timestamp}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{% if config.PUPPETDB_API > 2 %}
|
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
<h1>Facts</h1>
|
<h1>Facts</h1>
|
||||||
{{macros.facts_table(facts, condensed=True, margin_top=10)}}
|
{{macros.facts_table(facts, condensed=True, margin_top=10)}}
|
||||||
@@ -36,11 +33,5 @@
|
|||||||
<h1>Reports</h1>
|
<h1>Reports</h1>
|
||||||
{{ macros.reports_table(reports, node.name, condensed=True, hash_truncate=True, show_conf_col=False, show_agent_col=False, show_host_col=False)}}
|
{{ macros.reports_table(reports, node.name, condensed=True, hash_truncate=True, show_conf_col=False, show_agent_col=False, show_host_col=False)}}
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
|
||||||
<div class="span8">
|
|
||||||
<h1>Facts</h1>
|
|
||||||
{{macros.facts_table(facts, condensed=True, margin_top=10)}}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|||||||
@@ -21,10 +21,8 @@
|
|||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Hostname</th>
|
<th>Hostname</th>
|
||||||
<th>Catalog compiled at</th>
|
<th>Catalog compiled at</th>
|
||||||
{% if config.PUPPETDB_API > 2 %}
|
|
||||||
<th>Last report</th>
|
<th>Last report</th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
{% endif %}
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="searchable">
|
<tbody class="searchable">
|
||||||
@@ -38,7 +36,6 @@
|
|||||||
</td>
|
</td>
|
||||||
<td><a href="{{url_for('node', node_name=node.name)}}">{{node.name}}</a></td>
|
<td><a href="{{url_for('node', node_name=node.name)}}">{{node.name}}</a></td>
|
||||||
<td rel="utctimestamp">{{node.catalog_timestamp}}</td>
|
<td rel="utctimestamp">{{node.catalog_timestamp}}</td>
|
||||||
{% if config.PUPPETDB_API > 2 %}
|
|
||||||
<td>
|
<td>
|
||||||
{% if node.report_timestamp %}
|
{% if node.report_timestamp %}
|
||||||
<span rel="utctimestamp">{{ node.report_timestamp }}</span>
|
<span rel="utctimestamp">{{ node.report_timestamp }}</span>
|
||||||
@@ -52,7 +49,6 @@
|
|||||||
<a class="btn btn-small btn-primary" href="{{url_for('reports_node', node=node.name)}}">Reports</a>
|
<a class="btn btn-small btn-primary" href="{{url_for('reports_node', node=node.name)}}">Reports</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
{% endif %}
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Reference in New Issue
Block a user