diff --git a/puppetboard/app.py b/puppetboard/app.py index 677eb39..d7a5e22 100644 --- a/puppetboard/app.py +++ b/puppetboard/app.py @@ -27,7 +27,9 @@ from puppetboard.utils import ( app = Flask(__name__) app.config.from_object('puppetboard.default_settings') +graph_facts = app.config['GRAPH_FACTS'] app.config.from_envvar('PUPPETBOARD_SETTINGS', silent=True) +graph_facts += app.config['GRAPH_FACTS'] app.secret_key = os.urandom(24) app.jinja_env.filters['jsonprint'] = jsonprint @@ -116,7 +118,7 @@ def index(): 'unchanged': 0, 'failed': 0, 'unreported': 0, - 'noop': 0 + 'noop': 0 } for node in nodes: @@ -263,10 +265,14 @@ def fact(fact): node for which this fact is known.""" # we can only consume the generator once, lists can be doubly consumed # om nom nom + render_graph = False + if fact in graph_facts: + render_graph = True localfacts = [f for f in yield_or_stop(puppetdb.facts(name=fact))] return Response(stream_with_context(stream_template( 'fact.html', name=fact, + render_graph=render_graph, facts=localfacts))) diff --git a/puppetboard/default_settings.py b/puppetboard/default_settings.py index 813bc73..534602e 100644 --- a/puppetboard/default_settings.py +++ b/puppetboard/default_settings.py @@ -12,3 +12,14 @@ LOCALISE_TIMESTAMP = True LOGLEVEL = 'info' REPORTS_COUNT = 10 OFFLINE_MODE = False +GRAPH_FACTS = ['architecture', + 'domain', + 'lsbcodename', + 'lsbdistcodename', + 'lsbdistid', + 'lsbdistrelease', + 'lsbmajdistrelease', + 'netmask', + 'osfamily', + 'puppetversion', + 'processorcount'] diff --git a/puppetboard/templates/fact.html b/puppetboard/templates/fact.html index 5319003..6120fc0 100644 --- a/puppetboard/templates/fact.html +++ b/puppetboard/templates/fact.html @@ -2,7 +2,9 @@ {% import '_macros.html' as macros %} {% block content %}