summaryrefslogtreecommitdiffstats
path: root/src/lib/Component.py
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-12-31 11:21:10 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-12-31 11:21:10 +0000
commitef5051726a3aa1f0192bd8d99c5c5b1ee9f067af (patch)
tree57bf0854d95c18cced379921657f746ad5faab04 /src/lib/Component.py
parent104a1e27cee2d5524460d26c83d3e920cd88b2e9 (diff)
downloadbcfg2-ef5051726a3aa1f0192bd8d99c5c5b1ee9f067af.tar.gz
bcfg2-ef5051726a3aa1f0192bd8d99c5c5b1ee9f067af.tar.bz2
bcfg2-ef5051726a3aa1f0192bd8d99c5c5b1ee9f067af.zip
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
Diffstat (limited to 'src/lib/Component.py')
-rw-r--r--src/lib/Component.py28
1 files changed, 17 insertions, 11 deletions
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)