summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-12-08 21:21:11 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-12-09 07:17:30 -0500
commit2695e7a9af097596527edb52a722d17ea44601cc (patch)
tree118e4894aa678c5f60ac43860c7af18aade8434b /src/lib/Bcfg2
parent9a1f8dd769327cdb5aab86655780646bf1946516 (diff)
downloadbcfg2-2695e7a9af097596527edb52a722d17ea44601cc.tar.gz
bcfg2-2695e7a9af097596527edb52a722d17ea44601cc.tar.bz2
bcfg2-2695e7a9af097596527edb52a722d17ea44601cc.zip
Cfg: let EncryptedGenerator load setup object whenever the plugin is imported
Previously, if CfgEncryptedGenerator was imported before the Cfg object was instantiated, it would finalize the Bcfg2.Server.Plugins.Cfg.SETUP object with a value of None, and would be unable to access the options dict.
Diffstat (limited to 'src/lib/Bcfg2')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Cfg/CfgEncryptedGenerator.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Cfg/CfgEncryptedGenerator.py b/src/lib/Bcfg2/Server/Plugins/Cfg/CfgEncryptedGenerator.py
index 3b4703ddb..cf7eae75b 100644
--- a/src/lib/Bcfg2/Server/Plugins/Cfg/CfgEncryptedGenerator.py
+++ b/src/lib/Bcfg2/Server/Plugins/Cfg/CfgEncryptedGenerator.py
@@ -1,8 +1,9 @@
""" CfgEncryptedGenerator lets you encrypt your plaintext
:ref:`server-plugins-generators-cfg` files on the server. """
+import Bcfg2.Server.Plugins.Cfg
from Bcfg2.Server.Plugin import PluginExecutionError
-from Bcfg2.Server.Plugins.Cfg import CfgGenerator, SETUP
+from Bcfg2.Server.Plugins.Cfg import CfgGenerator
try:
from Bcfg2.Encryption import bruteforce_decrypt, EVPError, \
get_algorithm
@@ -34,8 +35,10 @@ class CfgEncryptedGenerator(CfgGenerator):
return
# todo: let the user specify a passphrase by name
try:
- self.data = bruteforce_decrypt(self.data, setup=SETUP,
- algorithm=get_algorithm(SETUP))
+ self.data = bruteforce_decrypt(
+ self.data,
+ setup=Bcfg2.Server.Plugins.Cfg.SETUP,
+ algorithm=get_algorithm(Bcfg2.Server.Plugins.Cfg.SETUP))
except EVPError:
raise PluginExecutionError("Failed to decrypt %s" % self.name)
handle_event.__doc__ = CfgGenerator.handle_event.__doc__