]> www.infradead.org Git - users/dhowells/kafs-utils.git/commitdiff
Provide separate arg interpretation functions for multivalued arguments
authorDavid Howells <dhowells@redhat.com>
Sat, 12 Apr 2014 14:51:03 +0000 (15:51 +0100)
committerDavid Howells <dhowells@redhat.com>
Sat, 12 Apr 2014 16:49:55 +0000 (17:49 +0100)
Provide separate arg interpretation functions for multivalued arguments so
that the single-valued versions return a non-list and the multivalued returns
a list.

Signed-off-by: David Howells <dhowells@redhat.com>
suite/argparse.py
suite/commands/bos/getdate.py
suite/commands/bos/status.py
suite/commands/vos/listvldb.py

index fcda4a6089cec1e8dfcbdfa237bd433fa24a5ea9..bcc2fa1ea4996121cd7068ae8c8d7361a16adff2 100644 (file)
@@ -39,13 +39,25 @@ def get_vlservers(switch, params):
 def get_volume_name(switch, params):
     return params[0]
 
+def get_volume_names(switch, params):
+    return params
+
 def get_machine_name(switch, params):
+    return params[0]
+
+def get_machine_names(switch, params):
     return params
 
 def get_path_name(switch, params):
+    return params[0]
+
+def get_path_names(switch, params):
     return params
 
 def get_file_name(switch, params):
+    return params[0]
+
+def get_file_names(switch, params):
     return params
 
 def get_partition_id(switch, params):
@@ -59,6 +71,11 @@ def get_uuid(switch, params):
     from afs.lib.uuid import str2uuid
     return str2uuid(params[0])
 
+def get_string(switch, params):
+    return params[0]
+
+def get_strings(switch, params):
+    return params
 
 def get_dummy(switch, params):
     return params
index a019d94ad92778ce1264f324a1eac6ee2400572f..9b1fd96adb06ad2900ead026cee5ae27367fa7a5 100644 (file)
@@ -29,7 +29,7 @@ help = "Display the time stamps on an AFS binary file"
 
 command_arguments = [
     [ "server",         get_bosserver,          "rs",         "<machine name>" ],
-    [ "file",           get_file_name         "rm",         "<files to check>+" ],
+    [ "file",           get_file_names,         "rm",         "<files to check>+" ],
     [ "dir",            get_path_name,          "os",         "<destination dir>" ],
     [ "cell",           get_cell,               "os",         "<cell name>" ],
     [ "noauth",         get_auth,               "fn" ],
@@ -52,7 +52,7 @@ def main(params):
     bos_conn = cell.open_bos_server(params["server"], params)
 
     if "dir" in params:
-        d = params["dir"][0]
+        d = params["dir"]
     else:
         d = "/usr/afs/bin"
 
index 413e1bd22f7a3d6ae5a8c16bd605693afdc450f1..789b45306ecb848fd3a19d556e66f5bd5907c548 100644 (file)
@@ -31,7 +31,7 @@ help = "Display the status of server processes"
 
 command_arguments = [
     [ "server",         get_bosserver,          "rs",         "<machine name>" ],
-    [ "instance",       get_file_name         "om",         "<server process name>+" ],
+    [ "instance",       get_file_names,         "om",         "<server process name>+" ],
     [ "long",           get_dummy,              "fn" ],
     [ "cell",           get_cell,               "os",         "<cell name>" ],
     [ "noauth",         get_auth,               "fn" ],
index 0859cea01035538ee6ca1118f8ba5577521edb3b..db310e9a08bc77d4a8df21d3e6083116fa3ea3e1 100644 (file)
@@ -69,7 +69,7 @@ def main(params):
     quiet = "quiet" in params
 
     if "name" in params:
-        ret = kafs.VL_GetEntryByName(z_conn, params["name"][0])
+        ret = kafs.VL_GetEntryByName(z_conn, params["name"])
         vldb = ret.entry
         print_record(params, vldb)
         return