Selecting which graphs to show with config option
Known-good facts to graph are set as defaults. This list is merged with whatever facts are listed in settings.py
This commit is contained in:
committed by
William Van Hevelingen
parent
3940c84de3
commit
7a0c4bd837
@@ -27,7 +27,9 @@ from puppetboard.utils import (
|
|||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config.from_object('puppetboard.default_settings')
|
app.config.from_object('puppetboard.default_settings')
|
||||||
|
graph_facts = app.config['GRAPH_FACTS']
|
||||||
app.config.from_envvar('PUPPETBOARD_SETTINGS', silent=True)
|
app.config.from_envvar('PUPPETBOARD_SETTINGS', silent=True)
|
||||||
|
graph_facts += app.config['GRAPH_FACTS']
|
||||||
app.secret_key = os.urandom(24)
|
app.secret_key = os.urandom(24)
|
||||||
|
|
||||||
app.jinja_env.filters['jsonprint'] = jsonprint
|
app.jinja_env.filters['jsonprint'] = jsonprint
|
||||||
@@ -116,7 +118,7 @@ def index():
|
|||||||
'unchanged': 0,
|
'unchanged': 0,
|
||||||
'failed': 0,
|
'failed': 0,
|
||||||
'unreported': 0,
|
'unreported': 0,
|
||||||
'noop': 0
|
'noop': 0
|
||||||
}
|
}
|
||||||
|
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
@@ -263,10 +265,14 @@ def fact(fact):
|
|||||||
node for which this fact is known."""
|
node for which this fact is known."""
|
||||||
# we can only consume the generator once, lists can be doubly consumed
|
# we can only consume the generator once, lists can be doubly consumed
|
||||||
# om nom nom
|
# 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))]
|
localfacts = [f for f in yield_or_stop(puppetdb.facts(name=fact))]
|
||||||
return Response(stream_with_context(stream_template(
|
return Response(stream_with_context(stream_template(
|
||||||
'fact.html',
|
'fact.html',
|
||||||
name=fact,
|
name=fact,
|
||||||
|
render_graph=render_graph,
|
||||||
facts=localfacts)))
|
facts=localfacts)))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,3 +12,14 @@ LOCALISE_TIMESTAMP = True
|
|||||||
LOGLEVEL = 'info'
|
LOGLEVEL = 'info'
|
||||||
REPORTS_COUNT = 10
|
REPORTS_COUNT = 10
|
||||||
OFFLINE_MODE = False
|
OFFLINE_MODE = False
|
||||||
|
GRAPH_FACTS = ['architecture',
|
||||||
|
'domain',
|
||||||
|
'lsbcodename',
|
||||||
|
'lsbdistcodename',
|
||||||
|
'lsbdistid',
|
||||||
|
'lsbdistrelease',
|
||||||
|
'lsbmajdistrelease',
|
||||||
|
'netmask',
|
||||||
|
'osfamily',
|
||||||
|
'puppetversion',
|
||||||
|
'processorcount']
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
{% import '_macros.html' as macros %}
|
{% import '_macros.html' as macros %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>{{name}}{% if value %}/{{value}}{% endif %} ({{facts|length}})</h1>
|
<h1>{{name}}{% if value %}/{{value}}{% endif %} ({{facts|length}})</h1>
|
||||||
|
{% if render_graph %}
|
||||||
{{macros.facts_graph(facts, autofocus=True, show_node=True, margin_bottom=10)}}
|
{{macros.facts_graph(facts, autofocus=True, show_node=True, margin_bottom=10)}}
|
||||||
|
{% endif %}
|
||||||
{% if value %}
|
{% if value %}
|
||||||
{{macros.facts_table(facts, autofocus=True, show_node=True, show_value=False, margin_bottom=10)}}
|
{{macros.facts_table(facts, autofocus=True, show_node=True, show_value=False, margin_bottom=10)}}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|||||||
Reference in New Issue
Block a user