summaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authorAdrian Likins <alikins@grimlock.devel.redhat.com>2007-10-08 15:44:30 -0400
committerAdrian Likins <alikins@grimlock.devel.redhat.com>2007-10-08 15:44:30 -0400
commit4bc503c96cb1d6ac98a9b3aa288102fd539a046b (patch)
tree528a2c05686802be5dc8c69bfe634f7d9c3d60e4 /func
parent070d1700b915729421595b83993abc31005355c1 (diff)
downloadthird_party-func-4bc503c96cb1d6ac98a9b3aa288102fd539a046b.tar.gz
third_party-func-4bc503c96cb1d6ac98a9b3aa288102fd539a046b.tar.xz
third_party-func-4bc503c96cb1d6ac98a9b3aa288102fd539a046b.zip
er, merge?
wtf, I already committed and pushed these changes
Diffstat (limited to 'func')
-rwxr-xr-xfunc/overlord/client.py77
-rwxr-xr-xfunc/utils.py4
2 files changed, 8 insertions, 73 deletions
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)
+
+