puppetboard/app.py: Pep8 fixes

This commit is contained in:
Spencer Krum
2013-11-07 12:52:44 -08:00
parent 71c3f809ca
commit ac06c65d73

View File

@@ -103,7 +103,9 @@ def index():
'avg_resources_node': "{0:10.6f}".format(avg_resources_node['Value']), 'avg_resources_node': "{0:10.6f}".format(avg_resources_node['Value']),
} }
nodes = puppetdb.nodes(unreported=app.config['UNRESPONSIVE_HOURS'], with_status=True) nodes = puppetdb.nodes(
unreported=app.config['UNRESPONSIVE_HOURS'],
with_status=True)
nodes_overview = [] nodes_overview = []
stats = { stats = {
@@ -146,8 +148,11 @@ def nodes():
provide a search feature instead. provide a search feature instead.
""" """
status_arg = request.args.get('status', '') status_arg = request.args.get('status', '')
nodelist = puppetdb.nodes(
unreported=app.config['UNRESPONSIVE_HOURS'],
with_status=True)
nodes = [] nodes = []
for node in yield_or_stop(puppetdb.nodes(unreported=app.config['UNRESPONSIVE_HOURS'], with_status=True)): for node in yield_or_stop(nodelist):
if status_arg: if status_arg:
if node.status == status_arg: if node.status == status_arg:
nodes.append(node) nodes.append(node)
@@ -252,12 +257,18 @@ def fact(fact):
name=fact, name=fact,
facts=localfacts))) facts=localfacts)))
@app.route('/fact/<fact>/<value>') @app.route('/fact/<fact>/<value>')
def fact_value(fact, value): def fact_value(fact, value):
"""On asking for fact/value get all nodes with that fact.""" """On asking for fact/value get all nodes with that fact."""
facts = get_or_abort(puppetdb.facts, fact, value) facts = get_or_abort(puppetdb.facts, fact, value)
localfacts = [f for f in yield_or_stop(facts)] localfacts = [f for f in yield_or_stop(facts)]
return render_template('fact.html', name=fact, value=value, facts=localfacts) return render_template(
'fact.html',
name=fact,
value=value,
facts=localfacts)
@app.route('/query', methods=('GET', 'POST')) @app.route('/query', methods=('GET', 'POST'))
def query(): def query():