summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-01-23 16:33:19 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-01-23 16:33:19 -0500
commit4367811c2811d0305cd2be8a1bb7b44fff7a1329 (patch)
tree34de08bead54ebdf95295786945086bca75e7d25 /src/lib
parentadcd396e3dad04030ccbbff5c77c56df566dacab (diff)
downloadbcfg2-4367811c2811d0305cd2be8a1bb7b44fff7a1329.tar.gz
bcfg2-4367811c2811d0305cd2be8a1bb7b44fff7a1329.tar.bz2
bcfg2-4367811c2811d0305cd2be8a1bb7b44fff7a1329.zip
clarified handling of boolean values in packages.conf
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Server/Plugins/Packages/__init__.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/lib/Server/Plugins/Packages/__init__.py b/src/lib/Server/Plugins/Packages/__init__.py
index daa20404c..29f4cacd9 100644
--- a/src/lib/Server/Plugins/Packages/__init__.py
+++ b/src/lib/Server/Plugins/Packages/__init__.py
@@ -47,13 +47,25 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
@property
def disableResolver(self):
- return self.config.get("global", "resolver",
- default="enabled").lower() == "disabled"
+ try:
+ return not self.config.getboolean("global", "resolver")
+ except ValueError:
+ # for historical reasons we also accept "enabled" and
+ # "disabled", which are not handled according to the
+ # Python docs but appear to be handled properly by
+ # ConfigParser in at least some versions
+ return self.config.get("global", "resolver",
+ default="enabled").lower() == "disabled"
@property
def disableMetaData(self):
- return self.config.get("global", "metadata",
- default="enabled").lower() == "disabled"
+ try:
+ return not self.config.getboolean("global", "resolver")
+ except ValueError:
+ # for historical reasons we also accept "enabled" and
+ # "disabled"
+ return self.config.get("global", "metadata",
+ default="enabled").lower() == "disabled"
def create_config(self, entry, metadata):
""" create yum/apt config for the specified host """