diff options
author | Fabian Affolter <fabian@bernewireless.net> | 2010-12-08 23:27:15 +0100 |
---|---|---|
committer | Fabian Affolter <fabian@bernewireless.net> | 2010-12-08 23:27:15 +0100 |
commit | e833a7a76b231cd346f09c9a422ecb855d1cc6b4 (patch) | |
tree | e2762fc31e1162a6859dbd6cd7b5c28208296d9d /build/scripts-2.7/bcfg2-server | |
parent | baf5854f414c2a35887e3fbbcfd094e12e7c6ee7 (diff) | |
download | bcfg2-e833a7a76b231cd346f09c9a422ecb855d1cc6b4.tar.gz bcfg2-e833a7a76b231cd346f09c9a422ecb855d1cc6b4.tar.bz2 bcfg2-e833a7a76b231cd346f09c9a422ecb855d1cc6b4.zip |
Merge with upstream
Diffstat (limited to 'build/scripts-2.7/bcfg2-server')
-rwxr-xr-x | build/scripts-2.7/bcfg2-server | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/build/scripts-2.7/bcfg2-server b/build/scripts-2.7/bcfg2-server new file mode 100755 index 000000000..115708bf9 --- /dev/null +++ b/build/scripts-2.7/bcfg2-server @@ -0,0 +1,79 @@ +#!/usr/bin/python + +"""The XML-RPC Bcfg2 server.""" +__revision__ = '$Revision$' + +import logging +import os.path +import sys + +import Bcfg2.Logger +import Bcfg2.Options +import Bcfg2.Component +import Bcfg2.Server.Plugins.Metadata +from Bcfg2.Server.Core import CoreInitError + +logger = logging.getLogger('bcfg2-server') + +if __name__ == '__main__': + + OPTINFO = { + 'configfile': Bcfg2.Options.CFILE, + 'daemon' : Bcfg2.Options.DAEMON, + 'debug' : Bcfg2.Options.DEBUG, + 'help' : Bcfg2.Options.HELP, + 'verbose' : Bcfg2.Options.VERBOSE, + 'to_file' : Bcfg2.Options.LOGGING_FILE_PATH, + } + + OPTINFO.update({'repo' : Bcfg2.Options.SERVER_REPOSITORY, + 'plugins' : Bcfg2.Options.SERVER_PLUGINS, + 'password' : Bcfg2.Options.SERVER_PASSWORD, + 'fm' : Bcfg2.Options.SERVER_FILEMONITOR, + }) + + OPTINFO.update({'key' : Bcfg2.Options.SERVER_KEY, + 'cert' : Bcfg2.Options.SERVER_CERT, + 'ca' : Bcfg2.Options.SERVER_CA, + 'location' : Bcfg2.Options.SERVER_LOCATION, + 'passwd' : Bcfg2.Options.SERVER_PASSWORD, + 'static' : Bcfg2.Options.SERVER_STATIC, + 'encoding' : Bcfg2.Options.ENCODING, + 'filelog' : Bcfg2.Options.LOGGING_FILE_PATH, + 'protocol' : Bcfg2.Options.SERVER_PROTOCOL, + }) + + setup = Bcfg2.Options.OptionParser(OPTINFO) + setup.parse(sys.argv[1:]) + try: + # check whether the specified bcfg2.conf exists + if not os.path.exists(setup['configfile']): + print("Could not read %s" % setup['configfile']) + sys.exit(1) + Bcfg2.Component.run_component(Bcfg2.Server.Core.Core, + location=setup['location'], + daemon = setup['daemon'], + pidfile_name = setup['daemon'], + protocol = setup['protocol'], + to_file=setup['to_file'], + cfile=setup['configfile'], + register=False, + cls_kwargs={'repo':setup['repo'], + 'plugins':setup['plugins'], + 'password':setup['password'], + 'encoding':setup['encoding'], + 'ca':setup['ca'], + 'filemonitor':setup['fm'], + 'start_fam_thread':True}, + keyfile=setup['key'], + certfile=setup['cert'], + ca=setup['ca'], + ) + except CoreInitError, msg: + logger.error(msg) + logger.error("exiting") + sys.exit(1) + except KeyboardInterrupt: + sys.exit(1) + sys.exit(0) + |