[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[minion-cvs] Add download option to list-servers



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

Modified Files:
	ClientMain.py 
Log Message:
Add download option to list-servers

Index: ClientMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientMain.py,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- ClientMain.py	7 Jan 2003 05:33:39 -0000	1.37
+++ ClientMain.py	7 Jan 2003 19:06:26 -0000	1.38
@@ -1153,22 +1153,39 @@
   -h, --help:                Print this usage message and exit.
   -f <file>, --config=<file> Use a configuration file other than ~/.mixminionrc
                              (You can also use MIXMINIONRC=FILE)
+  -D <yes|no>, --download-directory=<yes|no>
+                             Force the client to download/not to download a
+                               fresh directory.
 """.strip()
 
 def listServers(cmd, args):
-    options, args = getopt.getopt(args, "hf:", ['help', 'config='])
+    options, args = getopt.getopt(args, "hf:D:",
+                                  ['help', 'config=', "download-directory="])
     configFile = None
+    download = None
     for o,v in options:
         if o in ('-h', '--help'):
             print _LIST_SERVERS_USAGE % cmd
             sys.exit(1)
         elif o in ('-f', '--config'):
             configFile = v
+        elif o in ('-D', '--download-directory'):
+            download = v.lower()
+            if download in ('0','no','false','n','f'):
+                download = 0
+            elif download in ('1','yes','true','y','t','force'):
+                download = 1
+            else:
+                usageAndExit(cmd,
+                      "Unrecognized value for %s. Expected 'yes' or 'no'"%o)
 
     config = readConfigFile(configFile)
-
+    LOG.configure(config)
+    LOG.setMinSeverity("INFO")
+    
     userdir = os.path.expanduser(config['User']['UserDir'])
     keystore = ClientKeystore(userdir)
+    keystore.updateDirectory(forceDownload=download)
 
     for line in keystore.listServers():
         print line
@@ -1186,13 +1203,15 @@
     configFile = None
     for o,v in options:
         if o in ('-h', '--help'):
-            print _LIST_SERVERS_USAGE % cmd
+            print _UPDATE_SERVERS_USAGE % cmd
             sys.exit(1)
         elif o in ('-f', '--config'):
             configFile = v
 
     config = readConfigFile(configFile)
-
+    LOG.configure(config)
+    LOG.setMinSeverity("INFO")
+    
     userdir = os.path.expanduser(config['User']['UserDir'])
     keystore = ClientKeystore(userdir)