diff options
author | Adrian Likins <alikins@grimlock.devel.redhat.com> | 2007-10-08 11:38:09 -0400 |
---|---|---|
committer | Adrian Likins <alikins@grimlock.devel.redhat.com> | 2007-10-08 11:38:09 -0400 |
commit | 8dde0749f34ca2092d406bc3894a7e276fabaae3 (patch) | |
tree | 3bfdec27727844688daf13d0671114c03b07c923 /func/overlord/func_command.py | |
parent | ce379bdb3d6ade0a6326d5d7cf9446389cf4d94b (diff) | |
download | func-8dde0749f34ca2092d406bc3894a7e276fabaae3.tar.gz func-8dde0749f34ca2092d406bc3894a7e276fabaae3.tar.xz func-8dde0749f34ca2092d406bc3894a7e276fabaae3.zip |
create a func/overkiad/cmd_modules sub dir
add it to the setup
use new func_command module for base class of commands
move Call class to cmd_modules/call
update scripts/func to use new commandline class
Diffstat (limited to 'func/overlord/func_command.py')
-rw-r--r-- | func/overlord/func_command.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/func/overlord/func_command.py b/func/overlord/func_command.py new file mode 100644 index 0000000..dceec18 --- /dev/null +++ b/func/overlord/func_command.py @@ -0,0 +1,44 @@ +#!/usr/bin/python + +import glob +import sys + + +import command +from cmd_modules import call + +class FuncCommandLine(command.Command): + name = "client" + useage = "func is the commandline interface to a func minion" + + subCommandClasses = [call.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 |