puppetboard/app.py: Using the plain-text metric name in metrics() (#259)
This fixes #258 URL quoting is now done in pypuppetdb >= 0.2.3 which contributed to the metric URL being double-quoted by the time it reached PuppetDB, which responds with a 404. Instead using the plain-text name to build the link to metric()
This commit is contained in:
@@ -771,10 +771,8 @@ def metrics(env):
|
|||||||
check_env(env, envs)
|
check_env(env, envs)
|
||||||
|
|
||||||
metrics = get_or_abort(puppetdb._query, 'mbean')
|
metrics = get_or_abort(puppetdb._query, 'mbean')
|
||||||
for key, value in metrics.items():
|
|
||||||
metrics[key] = value.split('/')[2]
|
|
||||||
return render_template('metrics.html',
|
return render_template('metrics.html',
|
||||||
metrics=sorted(metrics.items()),
|
metrics=sorted(metrics.keys()),
|
||||||
envs=envs,
|
envs=envs,
|
||||||
current_env=env)
|
current_env=env)
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Metrics</h1>
|
<h1>Metrics</h1>
|
||||||
<ul>
|
<ul>
|
||||||
{% for key,value in metrics %}
|
{% for metric in metrics %}
|
||||||
<li><a href="{{url_for('metric', env=current_env, metric=value)}}">{{key}}</li>
|
<li><a href="{{url_for('metric', env=current_env, metric=metric)}}">{{metric}}</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|||||||
Reference in New Issue
Block a user