From 5a12c08d2fdeaab657fe6422e8b7cacd9f2c6b96 Mon Sep 17 00:00:00 2001 From: Mike Terzo Date: Thu, 26 Jan 2017 17:29:59 -0500 Subject: [PATCH] Metrics can appear as paths, if these paths are passed to Flask, it 500's --- puppetboard/app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/puppetboard/app.py b/puppetboard/app.py index f23630620..f6ad01fd5 100644 --- a/puppetboard/app.py +++ b/puppetboard/app.py @@ -862,9 +862,9 @@ def metrics(env): current_env=env) -@app.route('/metric/', +@app.route('/metric/', defaults={'env': app.config['DEFAULT_ENVIRONMENT']}) -@app.route('//metric/') +@app.route('//metric/') def metric(env, metric): """Lists all information about the metric of the given name. @@ -876,7 +876,7 @@ def metric(env, metric): check_env(env, envs) name = unquote(metric) - metric = puppetdb.metric(metric) + metric = get_or_abort(puppetdb.metric, metric) return render_template( 'metric.html', name=name,