From 4bc503c96cb1d6ac98a9b3aa288102fd539a046b Mon Sep 17 00:00:00 2001 From: Adrian Likins Date: Mon, 8 Oct 2007 15:44:30 -0400 Subject: er, merge? wtf, I already committed and pushed these changes --- func/overlord/client.py | 77 +++---------------------------------------------- func/utils.py | 4 +++ 2 files changed, 8 insertions(+), 73 deletions(-) (limited to 'func') diff --git a/func/overlord/client.py b/func/overlord/client.py index 3c60148..ec304a5 100755 --- a/func/overlord/client.py +++ b/func/overlord/client.py @@ -22,9 +22,11 @@ import pprint from func.commonconfig import CMConfig from func.config import read_config, CONFIG_FILE + import sslclient import command +import func_command # =================================== # defaults @@ -174,7 +176,8 @@ class Client(object): meth = "%s.%s" % (module, method) retval = getattr(conn, meth)(*args[:]) if self.interactive: - pprint.pprint(retval) + print retval +# pprint.pprint(retval) except Exception, e: retval = e if self.interactive: @@ -220,76 +223,4 @@ class Client(object): max = x return max -# =================================================================== - -class Call(command.Command): - name = "call" - useage = "call nodule method name arg1 arg2..." - def addOptions(self): - self.parser.add_option("-v", "--verbose", dest="verbose", - action="store_true") - self.parser.add_option("-p", "--port", dest="port", - default=DEFAULT_PORT) - - def handleOptions(self, options): - self.options = options - - self.verbose = options.verbose - self.port = options.port - # I'm not really a fan of the "module methodname" approach - # but we'll keep it for now -akl - - def do(self, args): - - # I'm not really a fan of the "module methodname" approach - # but we'll keep it for now -akl - - self.server_spec = args[0] - self.module = args[1] - self.method = args[2] - self.method_args = args[3:] - - client = Client(self.server_spec,port=self.port,interactive=True, - verbose=self.verbose, config=self.config) - results = client.run(self.module, self.method, self.method_args) - - # TO DO: add multiplexer support - # probably as a higher level module. - - return client.cli_return(results) - -class FuncCommandLine(command.Command): - name = "client" - useage = "func is the commandline interface to a func minion" - - subCommandClasses = [Call] - - def __init__(self): - - command.Command.__init__(self) - - def do(self, args): - pass - - def addOptions(self): - self.parser.add_option('', '--version', action="store_true", - help="show version information") - self.parser.add_option("--list-minions", dest="list_minions", - action="store_true", help="list all available minions") - - def handleOptions(self, options): - if options.version: - #FIXME - print "version is NOT IMPLEMENTED YET" - if options.list_minions: - self.list_minions() - - sys.exit(0) # stop execution - def list_minions(self): - print "Minions:" - gloob = "%s/%s.cert" % (self.config.certroot, "*") - certs = glob.glob(gloob) - for cert in certs: - host = cert.replace(self.config.certroot, "")[1:-5] - print " %s" % host diff --git a/func/utils.py b/func/utils.py index 8d9d383..de08ba9 100755 --- a/func/utils.py +++ b/func/utils.py @@ -17,6 +17,8 @@ import string import sys import traceback + + # this is kind of handy, so keep it around for now # but we really need to fix out server side logging and error # reporting so we don't need it @@ -45,3 +47,5 @@ def daemonize(pidfile=None): if pidfile is not None: open(pidfile, "w").write(str(pid)) sys.exit(0) + + -- cgit