From 96108cfae8b68d6265e4643ea9519bdfd9127752 Mon Sep 17 00:00:00 2001 From: Tim Laszlo Date: Mon, 15 Oct 2012 09:20:12 -0500 Subject: bcfg2-reports: updated to new schema --- src/lib/Bcfg2/Reporting/models.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/lib/Bcfg2/Reporting') diff --git a/src/lib/Bcfg2/Reporting/models.py b/src/lib/Bcfg2/Reporting/models.py index 374331632..3b8ccc52e 100644 --- a/src/lib/Bcfg2/Reporting/models.py +++ b/src/lib/Bcfg2/Reporting/models.py @@ -345,6 +345,15 @@ class BaseEntry(models.Model): raise ValueError("Invalid type %s" % name) + @classmethod + def entry_from_type(cls, etype): + for entry_cls in (ActionEntry, PackageEntry, PathEntry, ServiceEntry): + if etype == entry_cls.ENTRY_TYPE: + return entry_cls + else: + raise ValueError("Invalid type %s" % etype) + + @classmethod def entry_get_or_create(cls, act_dict, skip_fetch=False): """Helper to quickly lookup an object""" -- cgit v1.2.3-1-g7c22