diff options
author | Tim Laszlo <tim.laszlo@gmail.com> | 2012-10-11 13:40:11 -0500 |
---|---|---|
committer | Tim Laszlo <tim.laszlo@gmail.com> | 2012-10-11 13:40:11 -0500 |
commit | 281818e0b25b08d2fa5015c402abd7a4956afd42 (patch) | |
tree | aa7b8ab1392c1ad380f8f68adbd9ce593f6522a8 /src | |
parent | bfb559574a5e4dc4c44c4950cb722bd4e31c13a5 (diff) | |
download | bcfg2-281818e0b25b08d2fa5015c402abd7a4956afd42.tar.gz bcfg2-281818e0b25b08d2fa5015c402abd7a4956afd42.tar.bz2 bcfg2-281818e0b25b08d2fa5015c402abd7a4956afd42.zip |
Admin.Reports: Fix printStats decorator
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Bcfg2/Server/Admin/Reports.py | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/lib/Bcfg2/Server/Admin/Reports.py b/src/lib/Bcfg2/Server/Admin/Reports.py index a2c3b59b0..c2a04ffd2 100644 --- a/src/lib/Bcfg2/Server/Admin/Reports.py +++ b/src/lib/Bcfg2/Server/Admin/Reports.py @@ -39,22 +39,19 @@ def printStats(fn): Decorator for purging. Prints database statistics after a run. """ def print_stats(self, *data): - start_client = Client.objects.count() - start_i = Interaction.objects.count() - start_ei = Entries_interactions.objects.count() - start_perf = Performance.objects.count() + classes = (Client, Interaction, Performance, \ + FailureEntry, ActionEntry, PathEntry, PackageEntry, \ + ServiceEntry) + + starts = {} + for cls in classes: + starts[cls] = cls.objects.count() fn(self, *data) - self.log.info("Clients removed: %s" % - (start_client - Client.objects.count())) - self.log.info("Interactions removed: %s" % - (start_i - Interaction.objects.count())) - self.log.info("Interactions->Entries removed: %s" % - (start_ei - 0)) - # (start_ei - Entries_interactions.objects.count())) - self.log.info("Metrics removed: %s" % - (start_perf - Performance.objects.count())) + for cls in classes: + print("%s removed: %s" % (cls().__class__.__name__, + cls.objects.count() - starts[cls])) return print_stats |