Skip to content

Commit

Permalink
puppetboard/app.py: Using the plain-text metric name in metrics() (#259)
Browse files Browse the repository at this point in the history
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()
  • Loading branch information
corey-hammerton authored Jun 29, 2016
1 parent bf6f446 commit 2a6e238
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions puppetboard/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,10 +771,8 @@ def metrics(env):
check_env(env, envs)

metrics = get_or_abort(puppetdb._query, 'mbean')
for key, value in metrics.items():
metrics[key] = value.split('/')[2]
return render_template('metrics.html',
metrics=sorted(metrics.items()),
metrics=sorted(metrics.keys()),
envs=envs,
current_env=env)

Expand Down
4 changes: 2 additions & 2 deletions puppetboard/templates/metrics.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
{% block content %}
<h1>Metrics</h1>
<ul>
{% for key,value in metrics %}
<li><a href="{{url_for('metric', env=current_env, metric=value)}}">{{key}}</li>
{% for metric in metrics %}
<li><a href="{{url_for('metric', env=current_env, metric=metric)}}">{{metric}}</li>
{% endfor %}
</ul>
{% endblock content %}

0 comments on commit 2a6e238

Please sign in to comment.