From 14fd0d98b171169e58acf62c86ef1f3a5d5128ee Mon Sep 17 00:00:00 2001 From: Adrian Likins Date: Tue, 25 Sep 2007 18:14:18 -0400 Subject: fix up the wrapper scripts so that --daemon works correctly, and so the init scripts also work correctly --- func/certmaster.py | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'func') diff --git a/func/certmaster.py b/func/certmaster.py index b12ecdb..5305b68 100755 --- a/func/certmaster.py +++ b/func/certmaster.py @@ -28,7 +28,7 @@ import sha #from func.server import codes import func import func.certs - +import func.minion.utils class SimpleConfigFile(object): """simple config file object: @@ -176,3 +176,33 @@ def serve(xmlrpcinstance): server.logRequests = 0 # don't print stuff to console server.register_instance(xmlrpcinstance) server.serve_forever() + + +def main(argv): + + defaults = { 'listen_addr': 'localhost', + 'listen_port': '51235', + 'cadir': '/etc/pki/func/ca', + 'certroot': '/var/lib/func/certmaster/certs', + 'csrroot': '/var/lib/func/certmaster/csrs', + 'autosign': 'false' + } + + + cm = CertMaster('/etc/func/certmaster.conf', defaults) + + if "daemon" in argv or "--daemon" in argv: + func.minion.utils.daemonize("/var/run/certmaster.pid") + else: + print "serving...\n" + + + # just let exceptions bubble up for now + serve(cm) + + + +if __name__ == "__main__": + textdomain(I18N_DOMAIN) + main(sys.argv) + -- cgit