diff options
author | Adrian Likins <alikins@redhat.com> | 2007-09-25 18:14:18 -0400 |
---|---|---|
committer | Adrian Likins <alikins@redhat.com> | 2007-09-25 18:14:18 -0400 |
commit | 14fd0d98b171169e58acf62c86ef1f3a5d5128ee (patch) | |
tree | 58e05c896d45db420ce4d8f46a62c6879e02663c | |
parent | 6c38c3128afd8542d086ba998494e02872781b77 (diff) | |
download | func-14fd0d98b171169e58acf62c86ef1f3a5d5128ee.tar.gz func-14fd0d98b171169e58acf62c86ef1f3a5d5128ee.tar.xz func-14fd0d98b171169e58acf62c86ef1f3a5d5128ee.zip |
fix up the wrapper scripts so that --daemon works correctly, and so
the init scripts also work correctly
-rwxr-xr-x | func/certmaster.py | 32 | ||||
-rwxr-xr-x | minion/server.py | 12 | ||||
-rwxr-xr-x | scripts/certmaster | 13 |
3 files changed, 41 insertions, 16 deletions
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) + diff --git a/minion/server.py b/minion/server.py index 823d072..3762095 100755 --- a/minion/server.py +++ b/minion/server.py @@ -193,17 +193,17 @@ def main(argv): print "" print "Seriously.\n\n" - try: - serve() - except codes.FuncException, e: - print >> sys.stderr, 'error: %s' % e - sys.exit(1) if "daemon" in sys.argv or "--daemon" in sys.argv: - utils.daemonize("/var/run/vf_server.pid") + utils.daemonize("/var/run/funcd.pid") else: print "serving...\n" + try: + serve() + except codes.FuncException, e: + print >> sys.stderr, 'error: %s' % e + sys.exit(1) # ====================================================================================== diff --git a/scripts/certmaster b/scripts/certmaster index f4bcf53..d5f677d 100755 --- a/scripts/certmaster +++ b/scripts/certmaster @@ -2,15 +2,10 @@ from func import certmaster -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' - } +import sys -cm = certmaster.CertMaster('/etc/func/certmaster.conf', defaults) -certmaster.serve(cm) +if __name__ == "__main__": + certmaster.main(sys.argv) + |