summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-05-04 10:56:29 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-05-04 10:56:29 -0400
commita0fa9103721e6c165902d5db2e9b7b6cc2c30d5a (patch)
tree42578de756f166c1d23bcc4fccba5b9e716914b0 /src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
parentd1877090ad7c971140fcc25e3490e307fe8f7a49 (diff)
downloadbcfg2-a0fa9103721e6c165902d5db2e9b7b6cc2c30d5a.tar.gz
bcfg2-a0fa9103721e6c165902d5db2e9b7b6cc2c30d5a.tar.bz2
bcfg2-a0fa9103721e6c165902d5db2e9b7b6cc2c30d5a.zip
better support for re-reading packages.conf (and SimpleConfigs in general)
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Packages/Yum.py')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/Yum.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
index 85eadafb3..941203db3 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
@@ -15,6 +15,7 @@ from Bcfg2.Bcfg2Py3k import StringIO, cPickle, HTTPError, ConfigParser, file
from Bcfg2.Server.Plugins.Packages.Collection import Collection
from Bcfg2.Server.Plugins.Packages.Source import SourceInitError, Source, \
fetch_url
+from Bcfg2.Server.Plugins.Packages.PackagesConfig import PackagesConfig
logger = logging.getLogger(__name__)
@@ -91,12 +92,9 @@ class YumCollection(Collection):
self.keypath = os.path.join(self.basepath, "keys")
if len(sources):
- config = sources[0].config
- self.use_yum = has_yum and config.getboolean("yum",
- "use_yum_libraries",
- default=False)
+ self.config = sources[0].config
else:
- self.use_yum = False
+ self.config = PackageConfig('Packages')
if self.use_yum:
self.cachefile = os.path.join(self.cachepath,
@@ -110,13 +108,20 @@ class YumCollection(Collection):
self.cfgfile = os.path.join(self.configdir,
"%s-yum.conf" % self.cachekey)
self.write_config()
-
- self.helper = self.config.get("yum", "helper",
- default="/usr/sbin/bcfg2-yum-helper")
if has_pulp and self.has_pulp_sources:
_setup_pulp(self.config)
@property
+ def helper(self):
+ return self.config.get("yum", "helper",
+ default="/usr/sbin/bcfg2-yum-helper")
+
+ @property
+ def use_yum(self):
+ return has_yum and self.config.getboolean("yum", "use_yum_libraries",
+ default=False)
+
+ @property
def has_pulp_sources(self):
""" see if there are any pulp sources to handle """
for source in self.sources:
@@ -492,8 +497,10 @@ class YumSource(Source):
self.needed_paths = set()
self.file_to_arch = dict()
- self.use_yum = has_yum and config.getboolean("yum", "use_yum_libraries",
- default=False)
+ @property
+ def use_yum(self):
+ return has_yum and self.config.getboolean("yum", "use_yum_libraries",
+ default=False)
def save_state(self):
if not self.use_yum: