diff options
Diffstat (limited to 'certmaster/overlord')
18 files changed, 0 insertions, 549 deletions
diff --git a/certmaster/overlord/__init__.pyc b/certmaster/overlord/__init__.pyc Binary files differdeleted file mode 100644 index f74bc59..0000000 --- a/certmaster/overlord/__init__.pyc +++ /dev/null diff --git a/certmaster/overlord/client.pyc b/certmaster/overlord/client.pyc Binary files differdeleted file mode 100644 index 5c7874e..0000000 --- a/certmaster/overlord/client.pyc +++ /dev/null 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 Binary files differdeleted file mode 100644 index 287b354..0000000 --- a/certmaster/overlord/cmd_modules/__init__.pyc +++ /dev/null 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 Binary files differdeleted file mode 100644 index f6c588d..0000000 --- a/certmaster/overlord/cmd_modules/call.pyc +++ /dev/null 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 diff --git a/certmaster/overlord/command.pyc b/certmaster/overlord/command.pyc Binary files differdeleted file mode 100644 index 6fa44e8..0000000 --- a/certmaster/overlord/command.pyc +++ /dev/null diff --git a/certmaster/overlord/forkbomb.pyc b/certmaster/overlord/forkbomb.pyc Binary files differdeleted file mode 100644 index 308557d..0000000 --- a/certmaster/overlord/forkbomb.pyc +++ /dev/null diff --git a/certmaster/overlord/func_command.pyc b/certmaster/overlord/func_command.pyc Binary files differdeleted file mode 100644 index 1834e0e..0000000 --- a/certmaster/overlord/func_command.pyc +++ /dev/null diff --git a/certmaster/overlord/groups.pyc b/certmaster/overlord/groups.pyc Binary files differdeleted file mode 100644 index 9ed2a92..0000000 --- a/certmaster/overlord/groups.pyc +++ /dev/null diff --git a/certmaster/overlord/jobthing.pyc b/certmaster/overlord/jobthing.pyc Binary files differdeleted file mode 100644 index cba36cb..0000000 --- a/certmaster/overlord/jobthing.pyc +++ /dev/null diff --git a/certmaster/overlord/modules/netapp.py b/certmaster/overlord/modules/netapp.py deleted file mode 100644 index 987901e..0000000 --- a/certmaster/overlord/modules/netapp.py +++ /dev/null @@ -1,82 +0,0 @@ -## -## Overlord library to interface with minion-side netapp operations -## -## Most of this is just wrappers to create some cleaner, earier to use -## interfaces. Also allows users to get function signatures and use -## nice things like kwargs client side, for those of us who can't live -## without ipython introspection. -## -## Copyright 2008, Red Hat, Inc -## John Eckersberg <jeckersb@redhat.com> -## -## 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. -## - -from func.overlord.client import Client - -class RemoteError(Exception): pass - -def _(res): - if type(res) == type([]) and res[0] == 'REMOTE_ERROR': - raise RemoteError, res[2] - else: - return res - -class Filer(Client): - def __init__(self, filer, admin_host): - Client.__init__(self, admin_host) - self.filer = filer - self.admin_host = admin_host - - def create_volume(self, vol, aggr, size): - return _(self.netapp.vol.create(self.filer, vol, aggr, size)[self.admin_host]) - - def destroy_volume(self, vol): - # offline it first - try: - self.netapp.vol.offline(self.filer, vol) - except: - pass - return _(self.netapp.vol.destroy(self.filer, vol)[self.admin_host]) - - def offline_volume(self, vol): - return _(self.netapp.vol.offline(self.filer, vol)[self.admin_host]) - - def online_volume(self, vol): - return _(self.netapp.vol.online(self.filer, vol)[self.admin_host]) - - def get_volume_size(self, vol): - return _(self.netapp.vol.size(self.filer, vol)[self.admin_host]) - - def resize_volume(self, vol, delta): - return _(self.netapp.vol.size(self.filer, vol, delta)[self.admin_host]) - - def create_snapshot(self, vol, snap): - return _(self.netapp.snap.create(self.filer, vol, snap)[self.admin_host]) - - def delete_snapshot(self, vol, snap): - return _(self.netapp.snap.delete(self.filer, vol, snap)[self.admin_host]) - - def create_clone_volume(self, vol, parent, snap): - return _(self.netapp.vol.clone.create(self.filer, vol, parent, snap)[self.admin_host]) - - def split_clone_volume(self, vol): - return _(self.netapp.vol.clone.split(self.filer, vol)[self.admin_host]) - - def list_volumes(self): - vols = _(self.netapp.vol.status(self.filer)) - return_list = [] - for vol in vols: - return_list.append(vol['name']) - return return_list - - def volume_details(self, vol=None): - if vol: - return _(self.netapp.vol.status(self.filer, vol)[self.admin_host]) - else: - return _(self.netapp.vol.status(self.filer)[self.admin_host]) diff --git a/certmaster/overlord/sslclient.pyc b/certmaster/overlord/sslclient.pyc Binary files differdeleted file mode 100644 index fdc21f2..0000000 --- a/certmaster/overlord/sslclient.pyc +++ /dev/null diff --git a/certmaster/overlord/test_func.py b/certmaster/overlord/test_func.py deleted file mode 100755 index 2b3f041..0000000 --- a/certmaster/overlord/test_func.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/python - - -# FIXME: should import the client lib, not XMLRPC lib, when we are done - -import xmlrpclib -import sys - -TEST_GETATTR = True -TEST_PROCESS = False -TEST_VIRT = False -TEST_SERVICES = False -TEST_HARDWARE = False -TEST_SMART = True - -if TEST_GETATTR: - import func.overlord.client as func_client - print func_client.Client("*").hardware.pci_info() - #print func_client.Client("*").test.add(1,2) - #print func_client.Client("*").hardware.info() - #print func_client.Client("*").run("hardware","info",[]) - #print func_client.Client(socket.gethostname(),noglobs=True).test.add("1","2") - sys.exit(1) - -# get a connecton (to be replaced by client lib logic) -s = xmlrpclib.ServerProxy("http://127.0.0.1:51234") - -# here's the basic test... -print s.test.add(1, 2) - -if TEST_SMART: - print s.smart.info() - -if TEST_PROCESS: - print s.process.info() - # print s.process.pkill("thunderbird") - -# here's the service module testing -if TEST_SERVICES: - print s.service.restart("httpd") - -if TEST_HARDWARE: - print s.hardware.info() - -# this is so I can remember how the virt module works -if TEST_VIRT: - - # example of using koan to install a virtual machine - #s.virt_install("mdehaan.rdu.redhat.com","profileX") - - # wait ... - vms = s.virt.list_vms() - # example of stopping all stopped virtual machines - print "list of virtual instances = %s" % vms - for vm in vms: - status = s.virt.status(vm) - print status - if status == "shutdown": - s.virt.start(vm) - -# add more tests here |