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)
|
||||
facts = node.facts()
|
||||
if app.config['PUPPETDB_API'] > 2:
|
||||
reports = ten_reports(node.reports())
|
||||
else:
|
||||
reports = iter([])
|
||||
return render_template('node.html', node=node, facts=yield_or_stop(facts),
|
||||
reports=yield_or_stop(reports))
|
||||
|
||||
@@ -148,22 +145,14 @@ def node(node_name):
|
||||
def reports():
|
||||
"""Doesn't do much yet but is meant to show something like the reports of
|
||||
the last half our, something like that."""
|
||||
if app.config['PUPPETDB_API'] > 2:
|
||||
return render_template('reports.html')
|
||||
else:
|
||||
log.warn('PuppetDB API prior to v3 cannot access reports.')
|
||||
abort(412)
|
||||
|
||||
@app.route('/reports/<node>')
|
||||
def reports_node(node):
|
||||
"""Fetches all reports for a node and processes them eventually rendering
|
||||
a table displaying those reports."""
|
||||
if app.config['PUPPETDB_API'] > 2:
|
||||
reports = ten_reports(yield_or_stop(
|
||||
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,
|
||||
nodename=node)
|
||||
|
||||
@@ -175,10 +164,7 @@ def report_latest(node_name):
|
||||
"""
|
||||
# TODO: use limit parameter in _query to get just one report
|
||||
node = get_or_abort(puppetdb.node, node_name)
|
||||
if app.config['PUPPETDB_API'] > 2:
|
||||
reports = ten_reports(node.reports())
|
||||
else:
|
||||
reports = iter([])
|
||||
report = list(yield_or_stop(reports))[0]
|
||||
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
|
||||
report and their status.
|
||||
"""
|
||||
if app.config['PUPPETDB_API'] > 2:
|
||||
reports = puppetdb.reports('["=", "certname", "{0}"]'.format(node))
|
||||
else:
|
||||
log.warn('PuppetDB API prior to v3 cannot access reports.')
|
||||
abort(412)
|
||||
|
||||
for report in reports:
|
||||
if report.hash_ == report_id:
|
||||
|
||||
@@ -18,16 +18,13 @@
|
||||
<td>Facts retrieved at</td>
|
||||
<td rel="utctimestamp">{{node.facts_timestamp}}</td>
|
||||
</tr>
|
||||
{% if config.PUPPETDB_EXPERIMENTAL %}
|
||||
<tr>
|
||||
<td>Report uploaded at</td>
|
||||
<td rel="utctimestamp">{{node.report_timestamp}}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% if config.PUPPETDB_API > 2 %}
|
||||
<div class="span4">
|
||||
<h1>Facts</h1>
|
||||
{{macros.facts_table(facts, condensed=True, margin_top=10)}}
|
||||
@@ -36,11 +33,5 @@
|
||||
<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)}}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="span8">
|
||||
<h1>Facts</h1>
|
||||
{{macros.facts_table(facts, condensed=True, margin_top=10)}}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
||||
@@ -21,10 +21,8 @@
|
||||
<th>Status</th>
|
||||
<th>Hostname</th>
|
||||
<th>Catalog compiled at</th>
|
||||
{% if config.PUPPETDB_API > 2 %}
|
||||
<th>Last report</th>
|
||||
<th> </th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="searchable">
|
||||
@@ -38,7 +36,6 @@
|
||||
</td>
|
||||
<td><a href="{{url_for('node', node_name=node.name)}}">{{node.name}}</a></td>
|
||||
<td rel="utctimestamp">{{node.catalog_timestamp}}</td>
|
||||
{% if config.PUPPETDB_API > 2 %}
|
||||
<td>
|
||||
{% if node.report_timestamp %}
|
||||
<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>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user