From 7b0a8bcb94fc785bce1da87d7429b8163031d681 Mon Sep 17 00:00:00 2001 From: "Leigh B. Stoller" Date: Tue, 30 Aug 2005 14:48:04 +0000 Subject: [PATCH] Add tipacl routine to the script_wrapper to return and format the tipacl data. Sends it to stdout. --- xmlrpc/emulabserver.py.in | 3 +- xmlrpc/script_wrapper.py.in | 55 ++++++++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/xmlrpc/emulabserver.py.in b/xmlrpc/emulabserver.py.in index b70cec804..4f79856fa 100755 --- a/xmlrpc/emulabserver.py.in +++ b/xmlrpc/emulabserver.py.in @@ -2994,8 +2994,7 @@ class node: } return EmulabResponse(RESPONSE_SUCCESS, - value=result, - output=str(result)) + value=result) def sshdescription(self, version, argdict): if version != self.VERSION: diff --git a/xmlrpc/script_wrapper.py.in b/xmlrpc/script_wrapper.py.in index d6fc0aa46..cf1538d62 100755 --- a/xmlrpc/script_wrapper.py.in +++ b/xmlrpc/script_wrapper.py.in @@ -125,6 +125,8 @@ API = { "help" : "Upload code to a mote" }, "expwait" : { "func" : "expwait", "help" : "Wait for experiment to reach a state" }, + "tipacl" : { "func" : "tipacl", + "help" : "Get console acl" }, }; # @@ -1695,6 +1697,57 @@ class expwait: return pass +# +# tipacl (get console acl goo) +# +class tipacl: + def __init__(self, argv=None): + self.argv = argv; + return + + def apply(self): + try: + opts, req_args = getopt.getopt(self.argv, "", [ "help" ]); + pass + except getopt.error, e: + print e.args[0] + self.usage(); + return -1; + + params = {}; + for opt, val in opts: + if opt in ("-h", "--help"): + self.usage() + return 0 + pass + pass + + # Do this after so --help is seen. + if len(req_args) != 1: + self.usage(); + return -1; + + params["node"] = req_args[0]; + + rval,response = do_method("node", "console", params); + + if rval == 0: + for key in response["value"]: + val = response["value"][key]; + print "%s: %s" % (key, val) + pass + pass + + return rval; + + def usage(self): + print "tipacl node"; + print "where:"; + print " node - Node to get tipacl data for (pcXXX)"; + wrapperoptions(); + return + pass + # # Process program arguments. There are two ways we could be invoked. # 1) as the wrapper, with the first required argument the name of the script. @@ -1791,7 +1844,7 @@ else: token = sys.argv[len(wrapper_argv) + 1]; if not API.has_key(token): - print "Unknown script command!" + print "Unknown script command, ", token usage(); sys.exit(-1); pass -- GitLab