Module: check_mk
Branch: master
Commit: afc736ea69048fa0b369fb42bccc4fb6a9fc854d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=afc736ea69048f…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Apr 7 17:45:41 2011 +0200
BI: fix filter for only_service
---
.bugs/242 | 10 ++++++++++
web/htdocs/bi.py | 15 +++++++++------
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/.bugs/242 b/.bugs/242
new file mode 100644
index 0000000..26e2912
--- /dev/null
+++ b/.bugs/242
@@ -0,0 +1,10 @@
+Title: Filter for only_service in BI aggregations needs error handling
+Component: bi
+Benefit: 2
+State: open
+Cost: 2
+Date: 2011-04-07 17:44:13
+Class: bug
+
+If the selected service does not exist, an exception occurs. Tis
+is already fixed by not tested.
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index 3b20d51..3fb867b 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -921,12 +921,15 @@ def table(h, columns, add_headers, only_sites, limit, filters):
if only_service:
affected = g_affected_services.get(only_service)
- by_groups = {}
- for group, aggr in affected:
- entries = by_groups.get(group, [])
- entries.append(aggr)
- by_groups[group] = entries
- items = by_groups.items()
+ if affected == None:
+ items = []
+ else:
+ by_groups = {}
+ for group, aggr in affected:
+ entries = by_groups.get(group, [])
+ entries.append(aggr)
+ by_groups[group] = entries
+ items = by_groups.items()
else:
items = g_aggregation_forest.items()