summaryrefslogtreecommitdiffstats
path: root/certmaster/overlord/cmd_modules
diff options
context:
space:
mode:
Diffstat (limited to 'certmaster/overlord/cmd_modules')
-rw-r--r--certmaster/overlord/cmd_modules/__init__.py0
-rw-r--r--certmaster/overlord/cmd_modules/__init__.pycbin133 -> 0 bytes
-rw-r--r--certmaster/overlord/cmd_modules/call.py114
-rw-r--r--certmaster/overlord/cmd_modules/call.pycbin2900 -> 0 bytes
-rw-r--r--certmaster/overlord/cmd_modules/copyfile.py73
-rw-r--r--certmaster/overlord/cmd_modules/listminions.py51
-rw-r--r--certmaster/overlord/cmd_modules/ping.py69
-rw-r--r--certmaster/overlord/cmd_modules/show.py99
8 files changed, 0 insertions, 406 deletions
diff --git a/certmaster/overlord/cmd_modules/__init__.py b/certmaster/overlord/cmd_modules/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/certmaster/overlord/cmd_modules/__init__.py
+++ /dev/null
diff --git a/certmaster/overlord/cmd_modules/__init__.pyc b/certmaster/overlord/cmd_modules/__init__.pyc
deleted file mode 100644
index 287b354..0000000
--- a/certmaster/overlord/cmd_modules/__init__.pyc
+++ /dev/null
Binary files differ
diff --git a/certmaster/overlord/cmd_modules/call.py b/certmaster/overlord/cmd_modules/call.py
deleted file mode 100644
index 7add5bf..0000000
--- a/certmaster/overlord/cmd_modules/call.py
+++ /dev/null
@@ -1,114 +0,0 @@
-"""
-call func method invoker
-
-Copyright 2007, Red Hat, Inc
-see AUTHORS
-
-This software may be freely redistributed under the terms of the GNU
-general public license.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-"""
-
-
-import optparse
-import pprint
-import xmlrpclib
-
-from func.overlord import command
-from func.overlord import client
-
-DEFAULT_PORT = 51234
-DEFAULT_FORKS = 1
-
-class Call(client.command.Command):
- name = "call"
- usage = "call module method name arg1 arg2..."
- def addOptions(self):
- self.parser.add_option("-v", "--verbose", dest="verbose",
- action="store_true")
- self.parser.add_option("-x", "--xmlrpc", dest="xmlrpc",
- help="output return data in XMLRPC format",
- action="store_true")
- self.parser.add_option("", "--raw", dest="rawprint",
- help="output return data using Python print",
- action="store_true")
- self.parser.add_option("-j", "--json", dest="json",
- help="output return data using JSON",
- action="store_true")
- self.parser.add_option("-p", "--port", dest="port",
- default=DEFAULT_PORT)
- self.parser.add_option("-f", "--forks", dest="forks",
- help="how many parallel processes? (default 1)",
- default=DEFAULT_FORKS)
-
- 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 parse(self, argv):
- self.argv = argv
-
- return command.Command.parse(self, argv)
-
-
- def format_return(self, data):
- """
- The call module supports multiple output return types, the default is pprint.
- """
-
- if self.options.xmlrpc:
- return xmlrpclib.dumps((data,""))
-
- if self.options.json:
- try:
- import simplejson
- return simplejson.dumps(data)
- except ImportError:
- print "WARNING: json support not found, install python-simplejson"
- return data
-
- if self.options.rawprint:
- return data
-
- return pprint.pformat(data)
-
- def do(self, args):
-
- # I'm not really a fan of the "module methodname" approach
- # but we'll keep it for now -akl
-
- # I kind of feel like we shouldn't be parsing args here, but I'm
- # not sure what the write place is -al;
- self.module = args[0]
- if len(args) > 1:
- self.method = args[1]
- else:
- self.method = None
- if len(args) > 2:
- self.method_args = args[2:]
- else:
- self.method_args = []
-
- # this could get weird, sub sub classes might be calling this
- # this with multiple.parentCommand.parentCommands...
- # maybe command.py needs a way to set attrs on subCommands?
- # or some sort of shared datastruct?
- self.server_spec = self.parentCommand.server_spec
-
- client_obj = client.Client(self.server_spec,port=self.port,interactive=True,
- verbose=self.verbose, config=self.config, nforks=self.options.forks)
- results = client_obj.run(self.module, self.method, self.method_args)
-
- # TO DO: add multiplexer support
- # probably as a higher level module.
-
- # dump the return code stuff atm till we figure out the right place for it
- return self.format_return(results)
diff --git a/certmaster/overlord/cmd_modules/call.pyc b/certmaster/overlord/cmd_modules/call.pyc
deleted file mode 100644
index f6c588d..0000000
--- a/certmaster/overlord/cmd_modules/call.pyc
+++ /dev/null
Binary files differ
diff --git a/certmaster/overlord/cmd_modules/copyfile.py b/certmaster/overlord/cmd_modules/copyfile.py
deleted file mode 100644
index 295aeab..0000000
--- a/certmaster/overlord/cmd_modules/copyfile.py
+++ /dev/null
@@ -1,73 +0,0 @@
-"""
-copyfile command line
-
-Copyright 2007, Red Hat, Inc
-see AUTHORS
-
-This software may be freely redistributed under the terms of the GNU
-general public license.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-"""
-
-
-import optparse
-import os
-import pprint
-import stat
-import xmlrpclib
-
-from func.overlord import command
-from func.overlord import client
-
-DEFAULT_PORT = 51234
-
-class CopyFile(client.command.Command):
- name = "copyfile"
- usage = "copy a file to a client"
-
-
- def addOptions(self):
- self.parser.add_option("-f", "--file", dest="filename",
- action="store")
- self.parser.add_option("", "--remotepath", dest="remotepath",
- action="store")
- self.parser.add_option("", "--force", dest="force",
- action="store_true")
- self.parser.add_option("-v", "--verbose", dest="verbose",
- action="store_true")
- self.parser.add_option("-p", "--port", dest="port")
-
- def handleOptions(self, options):
- self.port = DEFAULT_PORT
- if self.options.port:
- self.port = self.options.port
-
-
- def do(self, args):
- self.server_spec = self.parentCommand.server_spec
-
- client_obj = client.Client(self.server_spec,
- port=self.port,
- interactive=False,
- verbose=self.options.verbose,
- config=self.config)
-
-
- try:
- fb = open(self.options.filename, "r").read()
- except IOError, e:
- print "Unable to open file: %s: %s" % (self.options.filename, e)
- return
-
- st = os.stat(self.options.filename)
- mode = stat.S_IMODE(st.st_mode)
- uid = st.st_uid
- gid = st.st_gid
-
-
- data = xmlrpclib.Binary(fb)
- results = client_obj.run("copyfile", "copyfile", [self.options.remotepath, data,
- mode, uid, gid])
diff --git a/certmaster/overlord/cmd_modules/listminions.py b/certmaster/overlord/cmd_modules/listminions.py
deleted file mode 100644
index 50c7e24..0000000
--- a/certmaster/overlord/cmd_modules/listminions.py
+++ /dev/null
@@ -1,51 +0,0 @@
-"""
-copyfile command line
-
-Copyright 2007, Red Hat, Inc
-see AUTHORS
-
-This software may be freely redistributed under the terms of the GNU
-general public license.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-"""
-
-
-import optparse
-import os
-
-from func.overlord import command
-from func.overlord import client
-DEFAULT_PORT = 51234
-
-class ListMinions(client.command.Command):
- name = "list_minions"
- usage = "show known minions"
-
- def addOptions(self):
- self.parser.add_option("-v", "--verbose", dest="verbose",
- action="store_true")
-
- def handleOptions(self, options):
- self.port = DEFAULT_PORT
- if options.verbose:
- self.verbose = self.options.verbose
-
- def do(self, args):
- self.server_spec = self.parentCommand.server_spec
-
- client_obj = client.Client(self.server_spec,
- port=self.port,
- interactive=False,
- verbose=self.options.verbose,
- config=self.config)
-
- servers = client_obj.servers
- print servers
- for server in servers:
- # just cause I hate regex'es -akl
- host = server.split(':')[-2]
- host = host.split('/')[-1]
- print host
diff --git a/certmaster/overlord/cmd_modules/ping.py b/certmaster/overlord/cmd_modules/ping.py
deleted file mode 100644
index f756fd9..0000000
--- a/certmaster/overlord/cmd_modules/ping.py
+++ /dev/null
@@ -1,69 +0,0 @@
-"""
-copyfile command line
-
-Copyright 2007, Red Hat, Inc
-Michael DeHaan <mdehaan@redhat.com>
-also see AUTHORS
-
-This software may be freely redistributed under the terms of the GNU
-general public license.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-"""
-
-import optparse
-import os
-import pprint
-import stat
-import xmlrpclib
-
-from func.overlord import command
-from func.overlord import client
-
-# FIXME: this really should not be in each sub module.
-DEFAULT_PORT = 51234
-
-
-class Ping(client.command.Command):
- name = "ping"
- usage = "see what func minions are up/accessible"
-
- def addOptions(self):
- """
- Not too many options for you! (Seriously, it's a simple command ... func "*" ping)
- """
- # FIXME: verbose and port should be added globally to all sub modules
- 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):
- """
- Nothing to do here...
- """
- pass
-
- def do(self, args):
- self.server_spec = self.parentCommand.server_spec
-
- # because this is mainly an interactive command, expand the server list and make seperate connections.
- # to make things look more speedy.
-
- servers = client.expand_servers(self.server_spec, port=self.options.port, noglobs=None,
- verbose=self.options.verbose, just_fqdns=True)
-
- for server in servers:
-
- client_obj = client.Client(server,port=self.options.port,interactive=False,
- verbose=self.options.verbose,config=self.config, noglobs=True)
-
- results = client_obj.run("test", "ping", [])
- if results == 1:
- print "[ ok ... ] %s" % server
- else:
- print "[ FAILED ] %s" % server
-
- return 1
diff --git a/certmaster/overlord/cmd_modules/show.py b/certmaster/overlord/cmd_modules/show.py
deleted file mode 100644
index e1df554..0000000
--- a/certmaster/overlord/cmd_modules/show.py
+++ /dev/null
@@ -1,99 +0,0 @@
-"""
-show introspection commandline
-
-Copyright 2007, Red Hat, Inc
-see AUTHORS
-
-This software may be freely redistributed under the terms of the GNU
-general public license.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-"""
-
-
-import optparse
-import pprint
-import xmlrpclib
-
-from func.overlord import command
-from func.overlord import client
-
-DEFAULT_PORT = 51234
-
-
-class ShowHardware(client.command.Command):
- name = "hardware"
- usage = "show hardware details"
-
- # FIXME: we might as well make verbose be in the subclass
- # and probably an inc variable while we are at it
- def addOptions(self):
- self.parser.add_option("-v", "--verbose", dest="verbose",
- action="store_true")
- self.parser.add_option("-p", "--port", dest="port")
-
-
- def handleOptions(self, options):
- self.port = DEFAULT_PORT
- if self.options.port:
- self.port = self.options.port
-
- def parse(self, argv):
- self.argv = argv
- return command.Command.parse(self,argv)
-
- def do(self,args):
-
- self.server_spec = self.parentCommand.parentCommand.server_spec
-
- client_obj = client.Client(self.server_spec,
- port=self.port,
- interactive=False,
- verbose=self.options.verbose,
- config=self.config)
-
- results = client_obj.run("hardware", "info", [])
-
- # if the user
- top_options = ["port","verbose"]
-
- for minion in results:
- print "%s:" % minion
- minion_data = results[minion]
- # if user set no args
- if not args:
- pprint.pprint(minion_data)
- continue
-
- for arg in args:
- if arg in minion_data:
- print minion_data[arg]
-
-
-class Show(client.command.Command):
- name = "show"
- usage = "various simple report stuff"
- subCommandClasses = [ShowHardware]
- 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
-
-
- def parse(self, argv):
- self.argv = argv
-
- return command.Command.parse(self, argv)
-
-
- def do(self, args):
- pass