[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Block deprecated commands, add test for broken python i...



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv13835/lib/mixminion

Modified Files:
	Main.py 
Log Message:
Block deprecated commands, add test for broken python installations on solaris.

Index: Main.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Main.py,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- Main.py	6 Jun 2003 07:17:35 -0000	1.49
+++ Main.py	21 Jun 2003 07:24:07 -0000	1.50
@@ -116,8 +116,6 @@
     "unittests" :      ( 'mixminion.test',       'testAll' ),
     "benchmarks" :     ( 'mixminion.benchmark',  'timeAll' ),
     "send" :           ( 'mixminion.ClientMain', 'runClient' ),
-    # XXXX005 Obsolete; use "queue"; remove in 0.0.5
-    "pool" :           ( 'mixminion.ClientMain', 'runClient' ),
     "queue" :          ( 'mixminion.ClientMain', 'runClient' ),
     "import-server" :  ( 'mixminion.ClientMain', 'importServer' ),
     "list-servers" :   ( 'mixminion.ClientMain', 'listServers' ),
@@ -129,11 +127,7 @@
     "inspect-surbs" :  ( 'mixminion.ClientMain', 'inspectSURBs' ),
     "flush" :          ( 'mixminion.ClientMain', 'flushQueue' ),
     "inspect-queue" :   ( 'mixminion.ClientMain', 'listQueue' ),
-    # XXXX005 Obsolete; use "inspect-queue"; remove in 0.0.5
-    "inspect-pool" :   ( 'mixminion.ClientMain', 'listQueue' ),
     "ping" :           ( 'mixminion.ClientMain', 'runPing' ),
-    # XXXX005 Obsolete; use "server-start"; remove in 0.0.5
-    "server" :         ( 'mixminion.server.ServerMain', 'runServer' ),
     "server-start" :   ( 'mixminion.server.ServerMain', 'runServer' ),
     "server-stop" :    ( 'mixminion.server.ServerMain', 'signalServer' ),
     "server-reload" :  ( 'mixminion.server.ServerMain', 'signalServer' ),
@@ -142,6 +136,11 @@
     "server-stats" :   ( 'mixminion.server.ServerMain', 'printServerStats' ),
     "server-DELKEYS" : ( 'mixminion.server.ServerMain', 'runDELKEYS'),
     "dir":             ( 'mixminion.directory.DirMain', 'main'),
+    
+    # XXXX006 Obsolete commands.  Remove in 0.0.6
+    "server" :         ( 'mixminion.Main', 'rejectCommand' ),
+    "inspect-pool" :   ( 'mixminion.Main', 'rejectCommand' ),
+    "pool" :           ( 'mixminion.Main', 'rejectCommand' ),
 }
 
 _USAGE = (
@@ -185,6 +184,19 @@
     print "NOTE: This software is for testing only.  The user set is too small"
     print "      to be anonymous, and the code is too alpha to be reliable."
 
+def rejectCommand(cmd,args):
+    cmd = cmd.split()[-1]
+    newCmd = { "client" : "send",
+               "pool" : "queue",
+               "inspect-pool" : "inspect-queue",
+               "server" : "server-start" }.get(cmd)
+    if newCmd:
+        print "The command %r is obsolete.  Use %r instead."%(cmd,newCmd)
+    else:
+        print "The command %r is obsolete."%cmd
+
+    sys.exit(1)
+
 def printUsage():
     import mixminion
     print "Mixminion version %s" % mixminion.__version__
@@ -232,6 +244,13 @@
         e.dumpAndExit()
     except KeyboardInterrupt:
         print "Interrupted."
+    except ImportError, e:
+        if str(e).find("_socket") >= 0:
+            print "Error: Your python installation is missing the standard "
+            print "socket module.  Halting."
+            sys.exit(1)
+        else:
+            raise
 
 if __name__ == '__main__':
     main(sys.argv)