def ms_rpc(proxy, method_name, *args, **kw): """ Call a method on the MS (method_name). Take the argument vector *args and dictionary **kw (both taken from sys.argv), look up the method's parser, parse the arguments, and then issue the RPC call. """ verify_reply = True config = proxy.config if config.has_key("verify_reply"): # do not verify the reply (i.e. we might not know the Syndicate public key) verify_reply = config["verify_reply"] # parse arguments. # use lib to load and store temporary data for the argument parsers. lib = conf.ArgLib() lib.config = config try: args, kw, extras = conf.parse_args(config, method_name, args, kw, lib) except Exception, e: log.exception(e) log.error("Failed to parse arguments for '%s'" % method_name) raise e
def ms_rpc(proxy, method_name, *args, **kw): """ Call a method on the MS (method_name). Take the argument vector *args and dictionary **kw (both taken from sys.argv), look up the method's parser, parse the arguments, and then issue the RPC call. """ verify_reply = True config = proxy.config if config.has_key('verify_reply'): # do not verify the reply (i.e. we might not know the Syndicate public key) verify_reply = config['verify_reply'] # parse arguments. # use lib to load and store temporary data for the argument parsers. lib = conf.ArgLib() lib.config = config try: args, kw, extras = conf.parse_args(config, method_name, args, kw, lib) except Exception, e: log.exception(e) log.error("Failed to parse arguments for '%s'" % method_name) raise e
def __call__(self, *args, **kw): # parse arguments. # use lib to load and store temporary data for the argument parsers. lib = conf.ArgLib() lib.config = self.config lib.username = self.config["username"] args, kw, extras = conf.parse_args(self.config, self.method_name, args, kw, lib) # validate arguments valid = conf.validate_args(self.method_name, args, kw) if not valid: raise Exception("Invalid arguments for %s" % self.method_name) return call_method(self.config, self.client, self.method_name, args, kw)