From 8dde0749f34ca2092d406bc3894a7e276fabaae3 Mon Sep 17 00:00:00 2001 From: Adrian Likins Date: Mon, 8 Oct 2007 11:38:09 -0400 Subject: 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 --- func/overlord/func_command.py | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 func/overlord/func_command.py (limited to 'func/overlord/func_command.py') 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 -- cgit