[rhmessaging-commits] rhmessaging commits: r1768 - mgmt/cumin/bin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Thu Mar 6 19:34:26 EST 2008


Author: justi9
Date: 2008-03-06 19:34:26 -0500 (Thu, 06 Mar 2008)
New Revision: 1768

Modified:
   mgmt/cumin/bin/cumin
Log:
Turn ssl off by default and provide a command line option to enable it

Modified: mgmt/cumin/bin/cumin
===================================================================
--- mgmt/cumin/bin/cumin	2008-03-06 21:57:28 UTC (rev 1767)
+++ mgmt/cumin/bin/cumin	2008-03-07 00:34:26 UTC (rev 1768)
@@ -12,11 +12,12 @@
     --data URL            Connect to database at URL
                           (default postgesql://cumin@localhost/cumin)
     --port PORT           Run web server on port PORT (default 80)
+    --ssl yes             Serve pages using SSL
     --debug               Enable debugging"""
     
     sys.exit(1)
 
-def do_main(home, data, spec, port, debug):
+def do_main(home, data, spec, port, ssl, debug):
     app = Cumin(home, data, spec)
 
     if debug:
@@ -35,14 +36,23 @@
     host = socket.gethostname()
     server = CuminServer(app, host, port)
 
-    cpath = os.path.join(home, "etc", "cumin.crt")
-    kpath = os.path.join(home, "etc", "cumin.key")
+    if ssl:
+        cpath = os.path.join(home, "etc", "cumin.crt")
+        kpath = os.path.join(home, "etc", "cumin.key")
 
-    if os.path.isfile(cpath):
-        server.set_ssl_cert_path(cpath)
+        if os.path.isfile(cpath):
+            server.set_ssl_cert_path(cpath)
+        else:
+            print "Error: SSL certificate file '%s' not found" % cpath
+            print "Files '%s' and '%s' are required for SSL" % (cpath, kpath)
+            sys.exit(1)
 
-    if os.path.isfile(kpath):
-        server.set_ssl_key_path(kpath)
+        if os.path.isfile(kpath):
+            server.set_ssl_key_path(kpath)
+        else:
+            print "Error: SSL key file '%s' not found" % kpath
+            print "Files '%s' and '%s' are required for SSL" % (cpath, kpath)
+            sys.exit(1)
 
     try:
         server.start()
@@ -63,6 +73,7 @@
     config.add_param("data", "s", "postgresql://cumin@localhost/cumin")
     config.add_param("spec", "s", spec)
     config.add_param("port", "i", 80)
+    config.add_param("ssl", "b", False)
     config.add_param("debug", "b", False)
 
     config.load_file(os.path.join(home, "etc", "cumin.conf"))
@@ -75,9 +86,10 @@
     data = config.get("data")
     spec = config.get("spec")
     port = config.get("port")
+    ssl = config.get("ssl")
     debug = config.get("debug")
     
-    do_main(home, data, spec, port, debug)
+    do_main(home, data, spec, port, ssl, debug)
 
 if __name__ == "__main__":
     try:




More information about the rhmessaging-commits mailing list