From aa77983b6384f0f4ec84e4918a9d10b1df99b4e7 Mon Sep 17 00:00:00 2001 From: Tim Laszlo Date: Thu, 11 Oct 2012 14:31:59 -0500 Subject: Reports.Admin: Update prune for new schema --- src/lib/Bcfg2/Server/Admin/Reports.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/lib/Bcfg2/Server/Admin/Reports.py b/src/lib/Bcfg2/Server/Admin/Reports.py index e4125c2f8..1ff250bdf 100644 --- a/src/lib/Bcfg2/Server/Admin/Reports.py +++ b/src/lib/Bcfg2/Server/Admin/Reports.py @@ -41,7 +41,7 @@ def printStats(fn): def print_stats(self, *data): classes = (Client, Interaction, Performance, \ FailureEntry, ActionEntry, PathEntry, PackageEntry, \ - ServiceEntry) + ServiceEntry, Group, Bundle) starts = {} for cls in classes: @@ -227,11 +227,12 @@ class Reports(Bcfg2.Server.Admin.Mode): del a, b, c self.log.error(msg) - # bulk operations bypass the Interaction.delete method - self.log.debug("Pruning orphan Performance objects") - Performance.prune_orphans() - self.log.debug("Pruning orphan Reason objects") - Reason.prune_orphans() + # Prune any orphaned ManyToMany relations + for m2m in (ActionEntry, PackageEntry, PathEntry, ServiceEntry, \ + FailureEntry, Group, Bundle): + self.log.debug("Pruning any orphaned %s objects" % \ + m2m().__class__.__name__) + m2m.prune_orphans() if client and not filtered: '''Delete the client, ping data is automatic''' -- cgit v1.2.3-1-g7c22