Add OVERVIEW_FILTER (#196)

This commit is contained in:
Raphaël Pinson
2016-05-25 00:49:30 +02:00
committed by Corey Hammerton
parent eb893ffef5
commit 0576e6d955
2 changed files with 7 additions and 4 deletions

View File

@@ -140,7 +140,7 @@ def index(env):
check_env(env, envs)
if env == '*':
query = None
query = app.config['OVERVIEW_FILTER']
prefix = 'puppetlabs.puppetdb.population'
num_nodes = get_or_abort(
@@ -157,9 +157,11 @@ def index(env):
metrics['avg_resources_node'] = "{0:10.0f}".format(
avg_resources_node['Value'])
else:
query = '["and", {0}]'.format(
", ".join('["=", "{0}", "{1}"]'.format(field, env)
for field in ['catalog_environment', 'facts_environment']))
conditions = ", ".join('["=", "{0}", "{1}"]'.format(field, env)
for field in ['catalog_environment', 'facts_environment'])
if app.config['OVERVIEW_FILTER'] != None:
conditions += ", {0}".format(app.config['OVERVIEW_FILTER'])
query = '["and", {0}]'.format(conditions)
num_nodes = get_or_abort(
puppetdb._query,
'nodes',