X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=cmdline%2Fgenicli.py;h=40c9ff9b993f15452cd81c7cfb34c2f53a772ae2;hb=bbf7ca80d86c5b760b06381d780858ef0a9546e0;hp=20064606685cff21ba00481189888534aa7ffb32;hpb=05d17cbdde8d087a46f8807745b4e86f85e5646c;p=sfa.git diff --git a/cmdline/genicli.py b/cmdline/genicli.py index 20064606..40c9ff9b 100644 --- a/cmdline/genicli.py +++ b/cmdline/genicli.py @@ -32,6 +32,8 @@ gid_pkey_fn = None gid_fn = None filter = None +dump_fn = None + dump_parents = False leaf_name = None @@ -58,7 +60,8 @@ def showhelp(): print " --short ... list records in short format (name only)" print "commands:" print " resolve " - print " dumpCredential" + print " dumpCredential " + print " dumpGid " print " getCredential " print " list " print " start " @@ -82,6 +85,7 @@ def process_options(): global server_url global filter global short + global dump_fn (options, args) = getopt.getopt(sys.argv[1:], '', long_opts) for opt in options: @@ -179,6 +183,12 @@ def process_options(): sys.exit(-1) hrn = args[1] + elif opname == "dumpGid": + if len(args) < 2: + print "syntax: dumpGid " + sys.exit(-1) + dump_fn = args[1] + leaf_name = get_leaf(username) if cert_file == None: @@ -208,6 +218,10 @@ def get_authority(x): def dumpCredential(): pass +def dumpGid(): + gid = GID(filename = dump_fn) + gid.dump() + # creates a self-signed certificate and private key def createKey(): k = Keypair(create=True) @@ -253,7 +267,7 @@ def main(): # if the operation is not a local operation, then create a geniclient to # talk to the server - if (opname != "dumpCredential") and (opname != "help") and (opname != "createKey"): + if (opname != "dumpCredential") and (opname != "help") and (opname != "createKey") and (opname != "dumpGid"): if not os.path.exists(key_file): print "key file", key_file, "does not exist" sys.exit(-1) @@ -269,7 +283,7 @@ def main(): # if a cred_file was specified, then load the credential if (cred_file=="None") or (opname == "help") or (opname == "createKey") or \ - (opname == "redeemTicket"): + (opname == "redeemTicket") or (opname == "dumpCredential") or (opname == "dumpGid"): cred = None else: cred = Credential(filename = cred_file) @@ -277,6 +291,9 @@ def main(): if opname == "dumpCredential": dumpCredential() + elif opname == "dumpGid": + dumpGid() + elif opname == "help": showhelp()