summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Plugin
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-09-06 14:28:45 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-09-06 14:28:45 -0400
commitefb4b669cb78155a17ecb4ec94be0d689e864332 (patch)
tree7878214b8d8adccc549077cecddf8bf173108760 /src/lib/Bcfg2/Server/Plugin
parent6bb7d11b7ab9eb447fa661d1a2e74cb8cbde5fb2 (diff)
downloadbcfg2-efb4b669cb78155a17ecb4ec94be0d689e864332.tar.gz
bcfg2-efb4b669cb78155a17ecb4ec94be0d689e864332.tar.bz2
bcfg2-efb4b669cb78155a17ecb4ec94be0d689e864332.zip
fixed Plugin auto-name magic
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugin')
-rw-r--r--src/lib/Bcfg2/Server/Plugin/base.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Server/Plugin/base.py b/src/lib/Bcfg2/Server/Plugin/base.py
index 3667c0e8f..ad5418d57 100644
--- a/src/lib/Bcfg2/Server/Plugin/base.py
+++ b/src/lib/Bcfg2/Server/Plugin/base.py
@@ -42,11 +42,23 @@ class Debuggable(object):
self.logger.error(message)
+class ClassName(object):
+ """ This very simple descriptor class exists only to get the name
+ of the owner class. This is used because, for historical reasons,
+ we expect every plugin to have a ``name`` attribute that is in
+ almost all cases the same as the ``__class__.__name__`` attribute
+ of the plugin object. This makes that more dynamic so that each
+ plugin isn't repeating its own name. """
+
+ def __get__(self, inst, owner):
+ return owner.__name__
+
+
class Plugin(Debuggable):
""" The base class for all Bcfg2 Server plugins. """
#: The name of the plugin.
- name = property(lambda s: s.__class__.__name__)
+ name = ClassName()
#: The email address of the plugin author.
__author__ = 'bcfg-dev@mcs.anl.gov'