summaryrefslogtreecommitdiffstats
path: root/src/sbin
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2008-01-08 01:31:05 +0000
committerNarayan Desai <desai@mcs.anl.gov>2008-01-08 01:31:05 +0000
commit67d50c4f86d3aa0612f179de59061ff3d32aa86e (patch)
tree09638cb16ac3ec5863e91b6606e683d72a5e788c /src/sbin
parenta94af81bce14b39bde5f1e73f31a79756fc2b5bd (diff)
downloadbcfg2-67d50c4f86d3aa0612f179de59061ff3d32aa86e.tar.gz
bcfg2-67d50c4f86d3aa0612f179de59061ff3d32aa86e.tar.bz2
bcfg2-67d50c4f86d3aa0612f179de59061ff3d32aa86e.zip
Pull internal option parsing out of Core
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4198 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/sbin')
-rwxr-xr-xsrc/sbin/bcfg2-info14
-rwxr-xr-xsrc/sbin/bcfg2-server11
2 files changed, 19 insertions, 6 deletions
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info
index bde7ef868..296027034 100755
--- a/src/sbin/bcfg2-info
+++ b/src/sbin/bcfg2-info
@@ -23,10 +23,10 @@ def printTabular(rows):
print fstring % row
class infoCore(cmd.Cmd, Bcfg2.Server.Core.Core):
- def __init__(self):
+ def __init__(self, repo, struct, gens, passwd, svn):
cmd.Cmd.__init__(self)
try:
- Bcfg2.Server.Core.Core.__init__(self)
+ Bcfg2.Server.Core.Core.__init__(self, repo, struct, gens, passwd, svn)
except Bcfg2.Server.Core.CoreInitError, msg:
print "Core load failed because %s" % msg
raise SystemExit(1)
@@ -260,14 +260,20 @@ Usage: [quit|exit]"""
if __name__ == '__main__':
Bcfg2.Logging.setup_logging('bcfg2-info', to_syslog=False)
-
+ print dir(Bcfg2.Options)
optinfo = {
'configfile': Bcfg2.Options.CFILE,
'help': Bcfg2.Options.HELP,
}
+ optinfo.update({'repo': Bcfg2.Options.SERVER_REPOSITORY,
+ 'svn': Bcfg2.Options.SERVER_SVN,
+ 'structures': Bcfg2.Options.SERVER_STRUCTURES,
+ 'generators': Bcfg2.Options.SERVER_GENERATORS,
+ 'password': Bcfg2.Options.SERVER_PASSWORD})
setup = Bcfg2.Options.OptionParser(optinfo)
setup.parse(sys.argv[1:])
- loop = infoCore()
+ loop = infoCore(setup['repo'], setup['structures'], setup['generators'],
+ setup['password'], setup['svn'])
loop.plugins['Metadata'].load_probedata()
loop.do_loop()
diff --git a/src/sbin/bcfg2-server b/src/sbin/bcfg2-server
index ecb5b357d..489a5766d 100755
--- a/src/sbin/bcfg2-server
+++ b/src/sbin/bcfg2-server
@@ -20,7 +20,7 @@ def critical_error(operation):
raise Fault, (7, "Critical unexpected failure: %s" % (operation))
class SetupError(Exception):
- '''Used when the server can't be setup'''
+ '''Used when the server cant be setup'''
pass
class Bcfg2Serv(Bcfg2.Component.Component):
@@ -39,7 +39,8 @@ class Bcfg2Serv(Bcfg2.Component.Component):
raise SetupError
try:
- self.Core = Core()
+ self.Core = Core(setup['repo'], setup['structures'],
+ setup['generators'], setup['password'], setup['svn'])
except CoreInitError, msg:
logger.critical("Fatal error: %s" % (msg))
raise SystemExit, 1
@@ -185,6 +186,12 @@ if __name__ == '__main__':
'verbose' : Bcfg2.Options.VERBOSE,
}
+ OPTINFO.update({'repo': Bcfg2.Options.SERVER_REPOSITORY,
+ 'svn': Bcfg2.Options.SERVER_SVN,
+ 'structures': Bcfg2.Options.SERVER_STRUCTURES,
+ 'generators': Bcfg2.Options.SERVER_GENERATORS,
+ 'password': Bcfg2.Options.SERVER_PASSWORD})
+
setup = Bcfg2.Options.OptionParser(OPTINFO)
setup.parse(sys.argv[1:])
print setup