diff options
author | Tim Laszlo <tim.laszlo@gmail.com> | 2012-10-15 09:20:12 -0500 |
---|---|---|
committer | Tim Laszlo <tim.laszlo@gmail.com> | 2012-10-15 09:20:32 -0500 |
commit | 96108cfae8b68d6265e4643ea9519bdfd9127752 (patch) | |
tree | 2011d9cabf7fc84815fc8d5bc5f06d5cf408a979 /src/lib | |
parent | 9707ee8e4c495133f329000d3e5b89d8b84e5998 (diff) | |
download | bcfg2-96108cfae8b68d6265e4643ea9519bdfd9127752.tar.gz bcfg2-96108cfae8b68d6265e4643ea9519bdfd9127752.tar.bz2 bcfg2-96108cfae8b68d6265e4643ea9519bdfd9127752.zip |
bcfg2-reports: updated to new schema
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Bcfg2/Reporting/models.py | 9 |
1 files changed, 9 insertions, 0 deletions
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 @@ -346,6 +346,15 @@ class BaseEntry(models.Model): @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""" cls_name = cls().__class__.__name__ |