summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-01-13 08:15:37 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-01-13 08:15:37 -0500
commit001fb4c7e6ef4110aa5330213ac2d12ed62c6292 (patch)
tree78c0ccf37e5bc1ba24d4820a0b769a1ebad9bf7c
parent238f6446d09ca8e3b7a082876920922ee1eda4d2 (diff)
downloadbcfg2-001fb4c7e6ef4110aa5330213ac2d12ed62c6292.tar.gz
bcfg2-001fb4c7e6ef4110aa5330213ac2d12ed62c6292.tar.bz2
bcfg2-001fb4c7e6ef4110aa5330213ac2d12ed62c6292.zip
fixed bugs in Packages implementation of SimpleConfig
-rw-r--r--src/lib/Server/Plugins/Packages/Yum.py15
-rw-r--r--src/lib/Server/Plugins/Packages/__init__.py12
2 files changed, 13 insertions, 14 deletions
diff --git a/src/lib/Server/Plugins/Packages/Yum.py b/src/lib/Server/Plugins/Packages/Yum.py
index f3cb5a532..2dc9651cf 100644
--- a/src/lib/Server/Plugins/Packages/Yum.py
+++ b/src/lib/Server/Plugins/Packages/Yum.py
@@ -92,11 +92,9 @@ class YumCollection(Collection):
if len(sources):
config = sources[0].config
- self.use_yum = has_yum
- try:
- self.use_yum &= config.getboolean("yum", "use_yum_libraries")
- except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
- self.use_yum = False
+ self.use_yum = has_yum and config.getboolean("yum",
+ "use_yum_libraries",
+ default=False)
else:
self.use_yum = False
@@ -452,11 +450,8 @@ class YumSource(Source):
self.needed_paths = set()
self.file_to_arch = dict()
- self.use_yum = has_yum
- try:
- self.use_yum &= config.getboolean("yum", "use_yum_libraries")
- except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
- self.use_yum = False
+ self.use_yum = has_yum and config.getboolean("yum", "use_yum_libraries",
+ default=False)
def save_state(self):
if not self.use_yum:
diff --git a/src/lib/Server/Plugins/Packages/__init__.py b/src/lib/Server/Plugins/Packages/__init__.py
index b12d633f3..699e349b4 100644
--- a/src/lib/Server/Plugins/Packages/__init__.py
+++ b/src/lib/Server/Plugins/Packages/__init__.py
@@ -73,8 +73,10 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
entry.set('version', 'auto')
entry.set('type', collection.ptype)
elif entry.tag == 'Path':
- if (entry.get("name") == self.config.get("global", "yum_config") or
- entry.get("name") == self.config.get("global", "apt_config")):
+ if (entry.get("name") == self.config.get("global", "yum_config",
+ default="") or
+ entry.get("name") == self.config.get("global", "apt_config",
+ default="")):
self.create_config(entry, metadata)
def HandlesEntry(self, entry, metadata):
@@ -84,8 +86,10 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
return True
elif entry.tag == 'Path':
# managed entries for yum/apt configs
- if (entry.get("name") == self.config.get("global", "yum_config") or
- entry.get("name") == self.config.get("global", "apt_config")):
+ if (entry.get("name") == self.config.get("global", "yum_config",
+ default="") or
+ entry.get("name") == self.config.get("global", "apt_config",
+ default="")):
return True
return False