summaryrefslogtreecommitdiffstats
path: root/func/overlord/func_command.py
diff options
context:
space:
mode:
Diffstat (limited to 'func/overlord/func_command.py')
-rw-r--r--func/overlord/func_command.py44
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