summaryrefslogtreecommitdiffstats
path: root/src/lib/Server
diff options
context:
space:
mode:
authorTim Laszlo <tim.laszlo@gmail.com>2010-08-04 13:33:43 +0000
committerSol Jerome <sol.jerome@gmail.com>2010-08-04 16:59:36 -0500
commit4f59c2116ec7cbfac91a709b12e1a370e0c9650a (patch)
tree026e928b8a7c8ccd1a7274f7b60c84949620f103 /src/lib/Server
parent9ae740ec11040a07d3ebf5556955cb815c0d7826 (diff)
downloadbcfg2-4f59c2116ec7cbfac91a709b12e1a370e0c9650a.tar.gz
bcfg2-4f59c2116ec7cbfac91a709b12e1a370e0c9650a.tar.bz2
bcfg2-4f59c2116ec7cbfac91a709b12e1a370e0c9650a.zip
Packages: Move knobs to config.xml
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5999 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server')
-rw-r--r--src/lib/Server/Plugins/Packages.py38
1 files changed, 12 insertions, 26 deletions
diff --git a/src/lib/Server/Plugins/Packages.py b/src/lib/Server/Plugins/Packages.py
index 870a3f6b0..d2517590c 100644
--- a/src/lib/Server/Plugins/Packages.py
+++ b/src/lib/Server/Plugins/Packages.py
@@ -6,9 +6,7 @@ import logging
import lxml.etree
import os
import re
-import sys
import urllib2
-import ConfigParser
try:
from hashlib import md5
@@ -564,32 +562,8 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
self.cachepath = self.data + '/cache'
self.sentinels = set()
self.sources = []
-
- # Grab the config file location
- # XXX: Ugh...we need some help with Bcfg2's Option stuff
- cfile = '/etc/bcfg2.conf'
- if '-C' in sys.argv:
- inx = sys.argv.index('-C')
- if len(sys.argv) > inx + 1:
- cfile = sys.argv[inx + 1]
-
- CP = ConfigParser.ConfigParser()
- CP.read(cfile)
-
- # Did the user configure off the resolver?
self.disableResolver = False
- try:
- if CP.get('packages', 'resolver').lower() in ['0', 'false', 'no']:
- self.disableResolver = True
- except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
- pass
self.disableMetaData = False
- try:
- if CP.get('packages', 'metadata').lower() in ['0', 'false', 'no']:
- self.disableMetaData = True
- self.disableResolver = True
- except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
- pass
if not os.path.exists(self.cachepath):
# create cache directory if needed
@@ -748,6 +722,18 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
self.logger.error("Failed to read Packages configuration. Have" +
" you created your config.xml file?")
raise Bcfg2.Server.Plugin.PluginInitError
+
+ # Load Packages config
+ config = xdata.xpath('//Sources/Config')
+ if config:
+ if config[0].get("resolver", "enabled").lower() == "disabled":
+ self.logger.info("Packages: Resolver disabled")
+ self.disableResolver = True
+ if config[0].get("metadata", "enabled").lower() == "disabled":
+ self.logger.info("Packages: Metadata disabled")
+ self.disableResolver = True
+ self.disableMetaData = True
+
self.sentinels = set()
self.sources = []
for s in xdata.findall('.//APTSource'):