summaryrefslogtreecommitdiffstats
path: root/lite-xmlrpc.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-10-28 02:10:56 -0600
committerJason Gerard DeRose <jderose@redhat.com>2008-10-28 02:10:56 -0600
commitfbcb55bd11d17dbff8ec3c7c99cf7b3bb91d3752 (patch)
tree80b9e24f758f702d4f5bcf12f649632bf347a5c0 /lite-xmlrpc.py
parenta9f1c74a7fb7619cfcdb9f5eaf0f62745b1b551e (diff)
downloadfreeipa-fbcb55bd11d17dbff8ec3c7c99cf7b3bb91d3752.tar.gz
freeipa-fbcb55bd11d17dbff8ec3c7c99cf7b3bb91d3752.tar.xz
freeipa-fbcb55bd11d17dbff8ec3c7c99cf7b3bb91d3752.zip
lite-xmlrpc.py now uses api.bootstrap() property, logs to api.logger
Diffstat (limited to 'lite-xmlrpc.py')
-rwxr-xr-xlite-xmlrpc.py36
1 files changed, 10 insertions, 26 deletions
diff --git a/lite-xmlrpc.py b/lite-xmlrpc.py
index b057138c8..5e2112d70 100755
--- a/lite-xmlrpc.py
+++ b/lite-xmlrpc.py
@@ -38,11 +38,6 @@ from ipalib.util import xmlrpc_unmarshal
import traceback
import krbV
-api.load_plugins()
-
-
-PORT=8888
-
class StoppableXMLRPCServer(SimpleXMLRPCServer.SimpleXMLRPCServer):
"""Override of TIME_WAIT"""
allow_reuse_address = True
@@ -155,37 +150,26 @@ class LoggingSimpleXMLRPCRequestHandler(SimpleXMLRPCServer.SimpleXMLRPCRequestHa
if __name__ == '__main__':
- # Set up our logger
- logger = logging.getLogger('xmlrpcserver')
- hdlr = logging.FileHandler('xmlrpcserver.log')
- formatter = logging.Formatter("%(asctime)s %(levelname)s %(message)s")
- hdlr.setFormatter(formatter)
- logger.addHandler(hdlr)
- logger.setLevel(logging.INFO)
+ api.bootstrap(context='server', verbose=True)
+ logger = api.logger
# Set up the server
- XMLRPCServer = StoppableXMLRPCServer(("",PORT), LoggingSimpleXMLRPCRequestHandler)
-
+ XMLRPCServer = StoppableXMLRPCServer(
+ ('', api.env.lite_xmlrpc_port),
+ LoggingSimpleXMLRPCRequestHandler
+ )
XMLRPCServer.register_introspection_functions()
- api.finalize()
-
- # Initialize our environment
- config.set_default_env(api.env)
- env_dict = config.read_config()
- env_dict['server_context'] = True
- api.env.update(env_dict)
-
# Get and register all the methods
+ api.finalize()
for cmd in api.Command:
- logger.info("registering %s" % cmd)
+ logger.debug('registering %s', cmd)
XMLRPCServer.register_function(api.Command[cmd], cmd)
-
funcs = XMLRPCServer.funcs
- print "Listening on port %d" % PORT
+ logger.info('Listening on port %d', api.env.lite_xmlrpc_port)
try:
XMLRPCServer.serve_forever()
except KeyboardInterrupt:
XMLRPCServer.server_close()
- print "Server shutdown."
+ logger.info('Server shutdown.')