summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Reports/reports
diff options
context:
space:
mode:
authorTim Laszlo <tim.laszlo@gmail.com>2012-06-14 10:20:12 -0500
committerTim Laszlo <tim.laszlo@gmail.com>2012-06-14 10:21:32 -0500
commit3f3d2138aca930c59a2139f6ff2a5405c2449fe5 (patch)
treeae138e8a9c69d2dd1cfdb8cbb3b059b7a19cf9e7 /src/lib/Bcfg2/Server/Reports/reports
parent772ea973da6b425e9f2336ed64cb2fd1081b3256 (diff)
downloadbcfg2-3f3d2138aca930c59a2139f6ff2a5405c2449fe5.tar.gz
bcfg2-3f3d2138aca930c59a2139f6ff2a5405c2449fe5.tar.bz2
bcfg2-3f3d2138aca930c59a2139f6ff2a5405c2449fe5.zip
DBStats: Start loading good entries into the db
Diffstat (limited to 'src/lib/Bcfg2/Server/Reports/reports')
-rw-r--r--src/lib/Bcfg2/Server/Reports/reports/models.py2
-rw-r--r--src/lib/Bcfg2/Server/Reports/reports/views.py8
2 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/Bcfg2/Server/Reports/reports/models.py b/src/lib/Bcfg2/Server/Reports/reports/models.py
index 750add34d..3bce17a30 100644
--- a/src/lib/Bcfg2/Server/Reports/reports/models.py
+++ b/src/lib/Bcfg2/Server/Reports/reports/models.py
@@ -23,11 +23,13 @@ KIND_CHOICES = (
('Path', 'symlink'),
('Service', 'Service'),
)
+TYPE_GOOD = 0
TYPE_BAD = 1
TYPE_MODIFIED = 2
TYPE_EXTRA = 3
TYPE_CHOICES = (
+ (TYPE_GOOD, 'Good'),
(TYPE_BAD, 'Bad'),
(TYPE_MODIFIED, 'Modified'),
(TYPE_EXTRA, 'Extra'),
diff --git a/src/lib/Bcfg2/Server/Reports/reports/views.py b/src/lib/Bcfg2/Server/Reports/reports/views.py
index 2e2c361fe..439d01c7c 100644
--- a/src/lib/Bcfg2/Server/Reports/reports/views.py
+++ b/src/lib/Bcfg2/Server/Reports/reports/views.py
@@ -231,9 +231,11 @@ def common_problems(request, timestamp=None, threshold=None):
threshold = 10
c_intr = Interaction.objects.get_interaction_per_client_ids(timestamp)
- data_list = { 1: {}, 2: {}, 3: {}}
+ data_list = {}
+ [data_list.__setitem__(t_id, {}) \
+ for t_id, t_label in TYPE_CHOICES if t_id != TYPE_GOOD]
ldata = list(Entries_interactions.objects.filter(
- interaction__in=c_intr).values())
+ interaction__in=c_intr).exclude(type=TYPE_GOOD).values())
entry_ids = set([x['entry_id'] for x in ldata])
reason_ids = set([x['reason_id'] for x in ldata])
@@ -250,6 +252,8 @@ def common_problems(request, timestamp=None, threshold=None):
lists = []
for type, type_name in TYPE_CHOICES:
+ if type == TYPE_GOOD:
+ continue
lists.append([type_name.lower(), [(entries[e[0][0]], reasons[e[0][1]], e[1])
for e in sorted(data_list[type].items(), key=lambda x: len(x[1]), reverse=True)
if len(e[1]) > threshold]])