summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Laszlo <tim.laszlo@gmail.com>2012-06-05 14:54:04 -0500
committerTim Laszlo <tim.laszlo@gmail.com>2012-06-05 14:54:04 -0500
commitc6e7bfed9b6563b0c567997f063a8259ec548519 (patch)
treeda85645ce8e00da01c1ab0ddd3c94a5d0856742e
parent5de4020d2a2ed1028ce39d3a8bd3a8bd865fc8cd (diff)
downloadbcfg2-c6e7bfed9b6563b0c567997f063a8259ec548519.tar.gz
bcfg2-c6e7bfed9b6563b0c567997f063a8259ec548519.tar.bz2
bcfg2-c6e7bfed9b6563b0c567997f063a8259ec548519.zip
web_reports: Trap KeyError from duplicate metrics
In the unlikely event two interactions point to the same Metric, we could get a key error if they aren't in the same interaction set.
-rw-r--r--src/lib/Bcfg2/Server/Reports/reports/views.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Server/Reports/reports/views.py b/src/lib/Bcfg2/Server/Reports/reports/views.py
index 38a219167..0b8cb620a 100644
--- a/src/lib/Bcfg2/Server/Reports/reports/views.py
+++ b/src/lib/Bcfg2/Server/Reports/reports/views.py
@@ -364,7 +364,11 @@ def display_timing(request, timestamp=None):
for inter in inters]
for metric in Performance.objects.filter(interaction__in=list(mdict.keys())).all():
for i in metric.interaction.all():
- mdict[i][metric.metric] = metric.value
+ try:
+ mdict[i][metric.metric] = metric.value
+ except KeyError:
+ #In the unlikely event two interactions share a metric, ignore it
+ pass
return render_to_response('displays/timing.html',
{'metrics': list(mdict.values()),
'timestamp': timestamp},