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

@@ -0,0 +1,61 @@
{% extends 'layout.html' %}
{% block content %}
<div class="ui fluid icon input hide" style="margin-bottom:20px">
<input autofocus="autofocus" class="filter-table" placeholder="Type here to filter...">
</div>
<h1>Summary</h1>
<table class='ui basic table'>
<thead>
<tr>
<th>Hostname</th>
<th>Version</th>
<th>Transaction UUID</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="{{url_for('node', node_name=catalog.node)}}">{{catalog.node}}</a></td>
<td>{{catalog.version}}</td>
<td>{{catalog.transaction_uuid}}</td>
</tr>
</tbody>
</table>
<h1>Resources</h1>
<table class='ui basic table compact catalog'>
<thead>
<tr>
<th>Resource</th>
<th>Location</th>
</tr>
</thead>
<tbody class='searchable'>
{% for resource in catalog.get_resources() %}
<tr>
<td>{{resource.type_}}[{{resource.name}}]</td>
<td>{{resource.sourcefile}}:{{resource.sourceline}}</td>
</tr>
{% endfor %}
</tbody>
</table>
<h1>Edges</h1>
<table class="ui basic table compact catalog">
<thead>
<tr>
<th>Source</th>
<th>Relationship</th>
<th>Target</th>
</tr>
</thead>
<tbody>
{% for edge in catalog.get_edges() %}
<tr>
<td>{{edge.source}}</td>
<td>{{edge.relationship}}</td>
<td>{{edge.target}}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock content %}

View File

@@ -39,7 +39,7 @@
{% endif %}
</td>
<td><a href="{{url_for('node', node_name=node.name)}}">{{node.name}}</a></td>
<td rel="utctimestamp">{{node.catalog_timestamp}}</td>
<td><a rel="utctimestamp" href="{{url_for('catalog_node', node_name=node.name)}}">{{node.catalog_timestamp}}</a></td>
<td>
{% if node.report_timestamp %}
<a href="{{url_for('report_latest', node_name=node.name)}}" rel='utctimestamp'>{{ node.report_timestamp }}</a>