summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Plugins/Bundler.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-01-16 13:28:06 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-01-17 12:55:52 -0500
commit9be9cfec322518f764be9766b27d24132fc6a66f (patch)
treee7d1f419fe90c1ef1069446a67a7ace754df95de /src/lib/Bcfg2/Server/Plugins/Bundler.py
parent68804df4b5ccc251c788a99b5682bb9aba973cb9 (diff)
downloadbcfg2-9be9cfec322518f764be9766b27d24132fc6a66f.tar.gz
bcfg2-9be9cfec322518f764be9766b27d24132fc6a66f.tar.bz2
bcfg2-9be9cfec322518f764be9766b27d24132fc6a66f.zip
added module-level OptionParser to avoid passing it as an argument or global all over
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Bundler.py')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Bundler.py19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Bundler.py b/src/lib/Bcfg2/Server/Plugins/Bundler.py
index b200346bc..6dc3c2b1d 100644
--- a/src/lib/Bcfg2/Server/Plugins/Bundler.py
+++ b/src/lib/Bcfg2/Server/Plugins/Bundler.py
@@ -1,15 +1,15 @@
"""This provides bundle clauses with translation functionality."""
-import copy
-import logging
-import lxml.etree
import os
-import os.path
import re
import sys
+import copy
+import logging
+import lxml.etree
import Bcfg2.Server
import Bcfg2.Server.Plugin
import Bcfg2.Server.Lint
+from Bcfg2.Options import get_option_parser
try:
import genshi.template.base
@@ -19,9 +19,6 @@ except ImportError:
HAS_GENSHI = False
-SETUP = None
-
-
class BundleFile(Bcfg2.Server.Plugin.StructFile):
""" Representation of a bundle XML file """
def get_xml_value(self, metadata):
@@ -52,8 +49,9 @@ if HAS_GENSHI:
msg = "No parsed template information for %s" % self.name
self.logger.error(msg)
raise Bcfg2.Server.Plugin.PluginExecutionError(msg)
- stream = self.template.generate(metadata=metadata,
- repo=SETUP['repo']).filter(
+ stream = self.template.generate(
+ metadata=metadata,
+ repo=get_option_parser()['repo']).filter(
Bcfg2.Server.Plugins.TGenshi.removecomment)
data = lxml.etree.XML(stream.render('xml',
strip_whitespace=False),
@@ -102,9 +100,6 @@ class Bundler(Bcfg2.Server.Plugin.Plugin,
self.logger.error(msg)
raise Bcfg2.Server.Plugin.PluginInitError(msg)
- global SETUP
- SETUP = core.setup
-
def template_dispatch(self, name, _):
""" Add the correct child entry type to Bundler depending on
whether the XML file in question is a plain XML file or a