puppetboard: Adding Catalog Viewer

This makes use of the available catalog endpoints in pypuppetdb and PuppetDB
and displays to administrators the last compiled catalog for a node,
if the variable ENABLE_CATALOG is True (defaults to False)
This commit is contained in:
Corey Hammerton
2015-08-19 21:01:11 -04:00
parent 1253739bf3
commit bce33aee0f
6 changed files with 82 additions and 1 deletions

View File

@@ -403,3 +403,13 @@ def metric(metric):
'metric.html',
name=name,
metric=sorted(metric.items()))
@app.route('/catalog/<node_name>')
def catalog_node(node_name):
"""Fetches from PuppetDB the compiled catalog of a given node."""
if app.config['ENABLE_CATALOG']:
catalog = puppetdb.catalog(node=node_name)
return render_template('catalog.html', catalog=catalog)
else:
log.warn('Access to catalog interface disabled by administrator')
abort(403)