From ef5051726a3aa1f0192bd8d99c5c5b1ee9f067af Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Mon, 31 Dec 2007 11:21:10 +0000 Subject: Switch over to more Options usage and complete tests (everything appears to work now) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4142 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Component.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'src/lib/Component.py') diff --git a/src/lib/Component.py b/src/lib/Component.py index 442ea8112..2d6887a67 100644 --- a/src/lib/Component.py +++ b/src/lib/Component.py @@ -7,12 +7,10 @@ from base64 import decodestring import BaseHTTPServer, SimpleXMLRPCServer import Bcfg2.tlslite.errors import Bcfg2.tlslite.api - +import Bcfg2.Options import Bcfg2.Client.Proxy as Proxy from Bcfg2.tlslite.TLSConnection import TLSConnection -from Bcfg2.Settings import settings - log = logging.getLogger('Component') class ComponentInitError(Exception): @@ -149,18 +147,26 @@ class Component(TLSServer, self.logger = logging.getLogger('Component') self.children = [] self.static = True - - location = settings.COMPONENTS_BCFG2 - if settings.COMPONENTS_BCFG2_STATIC: - location = urlparse.urlparse(settings.COMPONENTS_BCFG2)[1].split(':') + options = {'location': Bcfg2.Options.SERVER_LOCATION, + 'static': Bcfg2.Options.SERVER_STATIC, + 'key': Bcfg2.Options.SERVER_KEY, + 'passwd': Bcfg2.Options.SERVER_PASSWORD, + } + opts = Bcfg2.Options.OptionParser(options) + opts.parse([]) + location = opts['location'] + if opts['static']: + location = urlparse.urlparse(location)[1].split(':') location = (location[0], int(location[1])) - if not settings.COMMUNICATION_KEY: - print "No key specified in '%s'" % settings.CONFIG_FILE + print opts + + if not opts['key']: + print "No key specified in '%s'" % setup['configfile'] raise SystemExit, 1 - keyfile = settings.COMMUNICATION_KEY + keyfile = opts['key'] - self.password = settings.COMMUNICATION_PASSWORD + self.password = opts['passwd'] try: TLSServer.__init__(self, location, keyfile, CobaltXMLRPCRequestHandler) -- cgit v1.2.3-1-g7c22