diff options
-rwxr-xr-x | minion/codes.py | 4 | ||||
-rwxr-xr-x | minion/server.py | 22 | ||||
-rwxr-xr-x | minion/utils.py | 28 | ||||
-rwxr-xr-x | modules/hardware.py | 12 | ||||
-rwxr-xr-x | modules/process.py | 2 | ||||
-rwxr-xr-x | modules/virt.py | 2 | ||||
-rwxr-xr-x | overlord/client.py | 2 | ||||
-rw-r--r-- | overlord/test_func.py | 38 |
8 files changed, 54 insertions, 56 deletions
diff --git a/minion/codes.py b/minion/codes.py index c549709..058ca44 100755 --- a/minion/codes.py +++ b/minion/codes.py @@ -17,9 +17,9 @@ import exceptions class FuncException(exceptions.Exception): - pass + pass class InvalidMethodException(FuncException): - pass + pass # FIXME: more sub-exceptions maybe diff --git a/minion/server.py b/minion/server.py index 5671836..7a11ab8 100755 --- a/minion/server.py +++ b/minion/server.py @@ -140,13 +140,12 @@ class FuncApiMethod: def serve(): - """ - Code for starting the XMLRPC service. - FIXME: make this HTTPS (see RRS code) and make accompanying Rails changes.. - """ - server =FuncSSLXMLRPCServer(('', 51234)) - server.logRequests = 0 # don't print stuff to console - server.serve_forever() + """ + Code for starting the XMLRPC service. + """ + server =FuncSSLXMLRPCServer(('', 51234)) + server.logRequests = 0 # don't print stuff to console + server.serve_forever() @@ -154,12 +153,11 @@ class FuncXMLRPCServer(SimpleXMLRPCServer.SimpleXMLRPCServer, XmlRpcInterface): def __init__(self, args): - self.allow_reuse_address = True - - self.modules = module_loader.load_modules() - SimpleXMLRPCServer.SimpleXMLRPCServer.__init__(self, args) - XmlRpcInterface.__init__(self) + self.allow_reuse_address = True + self.modules = module_loader.load_modules() + SimpleXMLRPCServer.SimpleXMLRPCServer.__init__(self, args) + XmlRpcInterface.__init__(self) class FuncSSLXMLRPCServer(AuthedXMLRPCServer.AuthedSSLXMLRPCServer, diff --git a/minion/utils.py b/minion/utils.py index b0b8b0d..7a6180d 100755 --- a/minion/utils.py +++ b/minion/utils.py @@ -67,13 +67,13 @@ def create_minion_keys(): if result: - cert_fo = open(cert_file, 'w') - cert_fo.write(cert_string) - cert_fo.close() - - ca_cert_fo = open(ca_cert_file, 'w') - ca_cert_fo.write(ca_cert_string) - ca_cert_fo.close() + cert_fo = open(cert_file, 'w') + cert_fo.write(cert_string) + cert_fo.close() + + ca_cert_fo = open(ca_cert_file, 'w') + ca_cert_fo.write(ca_cert_string) + ca_cert_fo.close() def submit_csr_to_master(csr_file, master_uri): """" @@ -93,9 +93,9 @@ def submit_csr_to_master(csr_file, master_uri): # but we really need to fix out server side logging and error # reporting so we don't need it def trace_me(): - x = traceback.extract_stack() - bar = string.join(traceback.format_list(x)) - return bar + x = traceback.extract_stack() + bar = string.join(traceback.format_list(x)) + return bar def daemonize(pidfile=None): @@ -107,13 +107,13 @@ def daemonize(pidfile=None): print pidfile pid = os.fork() if pid > 0: - sys.exit(0) + sys.exit(0) os.setsid() os.umask(0) pid = os.fork() if pid > 0: - if pidfile is not None: - open(pidfile, "w").write(str(pid)) - sys.exit(0) + if pidfile is not None: + open(pidfile, "w").write(str(pid)) + sys.exit(0) diff --git a/modules/hardware.py b/modules/hardware.py index 50dd705..e2455d1 100755 --- a/modules/hardware.py +++ b/modules/hardware.py @@ -50,13 +50,13 @@ class HardwareModule(func_module.FuncModule): label = data[0] for d in data: if d == '': - results[label] = current - current = "" - label = "" + results[label] = current + current = "" + label = "" else: - if label == "": - label = d - current = current + d + if label == "": + label = d + current = current + d return results diff --git a/modules/process.py b/modules/process.py index 78e5aea..94a0240 100755 --- a/modules/process.py +++ b/modules/process.py @@ -57,7 +57,7 @@ class ProcessModule(func_module.FuncModule): def kill(self,pid,signal="TERM"): if pid == "0": - raise codes.FuncException("Killing pid group 0 not permitted") + raise codes.FuncException("Killing pid group 0 not permitted") if signal == "": # this is default /bin/kill behaviour, it claims, but enfore it anyway signal = "-TERM" diff --git a/modules/virt.py b/modules/virt.py index 300ec89..7162a36 100755 --- a/modules/virt.py +++ b/modules/virt.py @@ -52,7 +52,7 @@ class FuncLibvirtConnection(): conn = libvirt.open("qemu:///system") if not conn: - raise codes.FuncException("hypervisor connection failure") + raise codes.FuncException("hypervisor connection failure") self.conn = conn diff --git a/overlord/client.py b/overlord/client.py index d9d5f4f..e0a0801 100755 --- a/overlord/client.py +++ b/overlord/client.py @@ -147,7 +147,7 @@ class Client(): for server in self.servers: - conn = sslclient.FuncServer(server, self.key, self.cert, self.ca ) + conn = sslclient.FuncServer(server, self.key, self.cert, self.ca ) # conn = xmlrpclib.ServerProxy(server) if self.interactive: diff --git a/overlord/test_func.py b/overlord/test_func.py index 59e92a0..4850675 100644 --- a/overlord/test_func.py +++ b/overlord/test_func.py @@ -14,13 +14,13 @@ 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) + 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") @@ -45,18 +45,18 @@ if TEST_HARDWARE: # 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) + # 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 |