summaryrefslogtreecommitdiffstats
path: root/src/sbin/bcfg2-server
blob: 1b923a4621985ba1657c8572c0b1b2ca8cb14f54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python

'''The XML-RPC Bcfg2 Server'''
__revision__ = '$Revision$'

import logging
import sys
from xmlrpclib import Fault

import Bcfg2.Logger
import Bcfg2.Options
import Bcfg2.Component
import Bcfg2.Daemon
import Bcfg2.Server.Plugins.Metadata
from Bcfg2.Server.Core import CoreInitError
import Bcfg2.Server.XMLRPC

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,
        }

    OPTINFO.update({'repo': Bcfg2.Options.SERVER_REPOSITORY,
                    'plugins': Bcfg2.Options.SERVER_PLUGINS,
                    'password': Bcfg2.Options.SERVER_PASSWORD,
                    'filemonitor': Bcfg2.Options.SERVER_FILEMONITOR,
                    })
    OPTINFO.update({'key'      : Bcfg2.Options.SERVER_KEY,
                    'cert'     : Bcfg2.Options.SERVER_CERT,
                    '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,
                    })


    setup = Bcfg2.Options.OptionParser(OPTINFO)
    setup.parse(sys.argv[1:])
    print setup
    try:
        Bcfg2.Component.run_component(Bcfg2.Server.XMLRPC.bcfg2_server,
                                      location=setup['location'],
                                      daemon = setup['daemon'],
                                      pidfile_name = setup['daemon'],
                                      register=False, cls_kwargs={'setup':setup},
                                      keyfile='/home/desai/tmp/cert2/b2-s/priv.key',
                                      certfile='/home/desai/tmp/cert2/b2-s/cert.pem',
                                      ca='/home/desai/tmp/cert2/ca-cert.pem',
                                      )
    except KeyboardInterrupt:
        sys.exit(1)
    sys.exit(1)