diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-08-09 11:25:15 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-08-09 11:52:20 -0400 |
commit | 1b6394708b267bcc9230fbb77e0fd4ad51f456b8 (patch) | |
tree | 479b5fc50c58f73abb871605836f0159958b450c /src/lib/Bcfg2/Server/Plugin.py | |
parent | c8ca57745a5ba5859ade9f36cd57b80210cc01f8 (diff) | |
download | bcfg2-1b6394708b267bcc9230fbb77e0fd4ad51f456b8.tar.gz bcfg2-1b6394708b267bcc9230fbb77e0fd4ad51f456b8.tar.bz2 bcfg2-1b6394708b267bcc9230fbb77e0fd4ad51f456b8.zip |
DatabaseBacked interface needs to be a Plugin object
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugin.py')
-rw-r--r-- | src/lib/Bcfg2/Server/Plugin.py | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/src/lib/Bcfg2/Server/Plugin.py b/src/lib/Bcfg2/Server/Plugin.py index 79350f800..035de1465 100644 --- a/src/lib/Bcfg2/Server/Plugin.py +++ b/src/lib/Bcfg2/Server/Plugin.py @@ -99,30 +99,6 @@ class Debuggable(object): self.logger.error(message) -class DatabaseBacked(object): - def __init__(self): - pass - - @property - def _use_db(self): - use_db = self.core.setup.cfp.getboolean(self.name.lower(), - "use_database", - default=False) - if use_db and has_django: - return True - elif not use_db: - return False - else: - self.logger.error("use_database is true but django not found") - return False - - - -class PluginDatabaseModel(object): - class Meta: - app_label = "Server" - - class Plugin(Debuggable): """This is the base class for all Bcfg2 Server plugins. Several attributes must be defined in the subclass: @@ -169,6 +145,26 @@ class Plugin(Debuggable): return "%s Plugin" % self.__class__.__name__ +class DatabaseBacked(Plugin): + @property + def _use_db(self): + use_db = self.core.setup.cfp.getboolean(self.name.lower(), + "use_database", + default=False) + if use_db and has_django: + return True + elif not use_db: + return False + else: + self.logger.error("use_database is true but django not found") + return False + + +class PluginDatabaseModel(object): + class Meta: + app_label = "Server" + + class Generator(object): """Generator plugins contribute to literal client configurations.""" def HandlesEntry(self, entry, metadata): |