summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevan Goodwin <dgoodwin@dangerouslyinc.com>2007-10-02 21:42:47 -0300
committerJames Bowes <jbowes@redhat.com>2007-10-02 21:33:49 -0400
commit1ce955ec36f775d8fde2cb9d7943178e8b9d60da (patch)
tree4c69d218fde87091d4e5d1f3138a435b9164dbf4
parent3c13a4f30f247f4aa75c02c65e6bb6e575e30d01 (diff)
downloadthird_party-func-1ce955ec36f775d8fde2cb9d7943178e8b9d60da.tar.gz
third_party-func-1ce955ec36f775d8fde2cb9d7943178e8b9d60da.tar.xz
third_party-func-1ce955ec36f775d8fde2cb9d7943178e8b9d60da.zip
Moved code under the func namespace.
Previously we had overlord, minion, modules, and func all at the root of the source tree. After install these would all be shuffled below func. Relocated them in the source tree to reflect this.
-rwxr-xr-xMakefile4
-rw-r--r--func/minion/AuthedXMLRPCServer.py (renamed from minion/AuthedXMLRPCServer.py)9
-rwxr-xr-xfunc/minion/Makefile (renamed from minion/Makefile)7
-rw-r--r--func/minion/__init__.py (renamed from minion/__init__.py)0
-rwxr-xr-xfunc/minion/codes.py (renamed from minion/codes.py)0
-rwxr-xr-xfunc/minion/module_loader.py (renamed from minion/module_loader.py)2
-rwxr-xr-xfunc/minion/modules/Makefile (renamed from modules/Makefile)7
-rw-r--r--func/minion/modules/__init__.py (renamed from modules/__init__.py)0
-rw-r--r--func/minion/modules/command.py (renamed from modules/command.py)2
-rw-r--r--func/minion/modules/copyfile.py (renamed from modules/copyfile.py)14
-rwxr-xr-xfunc/minion/modules/func_module.py (renamed from modules/func_module.py)8
-rwxr-xr-xfunc/minion/modules/hardware.py (renamed from modules/hardware.py)25
-rwxr-xr-xfunc/minion/modules/process.py (renamed from modules/process.py)7
-rwxr-xr-xfunc/minion/modules/reboot.py (renamed from modules/reboot.py)0
-rwxr-xr-xfunc/minion/modules/service.py (renamed from modules/service.py)0
-rwxr-xr-xfunc/minion/modules/smart.py (renamed from modules/smart.py)7
-rwxr-xr-xfunc/minion/modules/test.py (renamed from modules/test.py)0
-rwxr-xr-xfunc/minion/modules/virt.py (renamed from modules/virt.py)42
-rw-r--r--func/minion/modules/yum.py (renamed from modules/yum.py)0
-rwxr-xr-xfunc/minion/server.py (renamed from minion/server.py)32
-rw-r--r--func/minion/sub_process.py (renamed from minion/sub_process.py)0
-rwxr-xr-xfunc/minion/utils.py (renamed from minion/utils.py)24
-rwxr-xr-xfunc/overlord/Makefile (renamed from overlord/Makefile)7
-rw-r--r--func/overlord/__init__.py (renamed from overlord/__init__.py)0
-rwxr-xr-xfunc/overlord/client.py (renamed from overlord/client.py)24
-rw-r--r--func/overlord/command.py (renamed from overlord/command.py)4
-rw-r--r--func/overlord/sslclient.py (renamed from overlord/sslclient.py)8
-rw-r--r--func/overlord/test_func.py (renamed from overlord/test_func.py)5
-rw-r--r--setup.py5
29 files changed, 107 insertions, 136 deletions
diff --git a/Makefile b/Makefile
index 8ef2d33..50b065e 100755
--- a/Makefile
+++ b/Makefile
@@ -19,8 +19,8 @@ manpage:
pod2man --center="certmaster" --release="" ./docs/certmaster.pod | gzip -c > ./docs/certmaster.1.gz
pod2man --center="certmaster-ca" --release="" ./docs/certmaster-ca.pod | gzip -c > ./docs/certmaster-ca.1.gz
-messages: minion/*.py
- xgettext -k_ -kN_ -o $(MESSAGESPOT) minion/*.py
+messages: func/minion/*.py
+ xgettext -k_ -kN_ -o $(MESSAGESPOT) func/minion/*.py
sed -i'~' -e 's/SOME DESCRIPTIVE TITLE/func/g' -e 's/YEAR THE PACKAGE'"'"'S COPYRIGHT HOLDER/2007 Red Hat, inc. /g' -e 's/FIRST AUTHOR <EMAIL@ADDRESS>, YEAR/Adrian Likins <alikins@redhat.com>, 2007/g' -e 's/PACKAGE VERSION/func $(VERSION)-$(RELEASE)/g' -e 's/PACKAGE/func/g' $(MESSAGESPOT)
diff --git a/minion/AuthedXMLRPCServer.py b/func/minion/AuthedXMLRPCServer.py
index da6b18a..265d1b2 100644
--- a/minion/AuthedXMLRPCServer.py
+++ b/func/minion/AuthedXMLRPCServer.py
@@ -39,7 +39,7 @@ class AuthedSimpleXMLRPCRequestHandler(SimpleXMLRPCServer.SimpleXMLRPCRequestHan
self.connection = self.request # for doPOST
self.rfile = socket._fileobject(self.request, "rb", self.rbufsize)
self.wfile = socket._fileobject(self.request, "wb", self.wbufsize)
-
+
def do_POST(self):
self.server._this_request = (self.request, self.client_address)
try:
@@ -101,7 +101,7 @@ class TestServer(AuthedSSLXMLRPCServer):
def __init__(self, address, pkey, cert, ca_cert):
AuthedSSLXMLRPCServer.__init__(self, address, pkey, cert, ca_cert, self.auth_cb)
-
+
def _dispatch(self, method, params):
if method == 'trait_names' or method == '_getAttributeNames':
return dir(self)
@@ -115,10 +115,10 @@ class TestServer(AuthedSSLXMLRPCServer):
print dir(p)
print p.get_subject()
else:
- print 'no cert'
+ print 'no cert'
return "your mom"
-
+
def auth_cb(self, request, client_address):
peer_cert = request.get_peer_certificate()
return peer_cert.get_subject().CN
@@ -138,4 +138,3 @@ if __name__ == '__main__':
h = ReqHandler()
server.register_instance(h)
server.serve_forever()
-
diff --git a/minion/Makefile b/func/minion/Makefile
index 86a3db8..f2bc6c4 100755
--- a/minion/Makefile
+++ b/func/minion/Makefile
@@ -6,14 +6,13 @@ PYCHECKER = /usr/bin/pychecker
PYFLAKES = /usr/bin/pyflakes
clean::
- @rm -fv *.pyc *~ .*~ *.pyo
+ @rm -fv *.pyc *~ .*~ *.pyo
@find . -name .\#\* -exec rm -fv {} \;
@rm -fv *.rpm
-
-pychecker::
+
+pychecker::
@$(PYCHECKER) $(PYFILES) || exit 0
pyflakes::
@$(PYFLAKES) $(PYFILES) || exit 0
-
diff --git a/minion/__init__.py b/func/minion/__init__.py
index e69de29..e69de29 100644
--- a/minion/__init__.py
+++ b/func/minion/__init__.py
diff --git a/minion/codes.py b/func/minion/codes.py
index 058ca44..058ca44 100755
--- a/minion/codes.py
+++ b/func/minion/codes.py
diff --git a/minion/module_loader.py b/func/minion/module_loader.py
index 4538fb2..1339359 100755
--- a/minion/module_loader.py
+++ b/func/minion/module_loader.py
@@ -36,7 +36,7 @@ def module_walker(topdir):
# in the module name, and foo..bar doesnt work -akl
module_files.append(os.path.normpath("%s/%s" % (root, filename)))
-
+
return module_files
def load_modules(blacklist=None):
diff --git a/modules/Makefile b/func/minion/modules/Makefile
index 86a3db8..f2bc6c4 100755
--- a/modules/Makefile
+++ b/func/minion/modules/Makefile
@@ -6,14 +6,13 @@ PYCHECKER = /usr/bin/pychecker
PYFLAKES = /usr/bin/pyflakes
clean::
- @rm -fv *.pyc *~ .*~ *.pyo
+ @rm -fv *.pyc *~ .*~ *.pyo
@find . -name .\#\* -exec rm -fv {} \;
@rm -fv *.rpm
-
-pychecker::
+
+pychecker::
@$(PYCHECKER) $(PYFILES) || exit 0
pyflakes::
@$(PYFLAKES) $(PYFILES) || exit 0
-
diff --git a/modules/__init__.py b/func/minion/modules/__init__.py
index e69de29..e69de29 100644
--- a/modules/__init__.py
+++ b/func/minion/modules/__init__.py
diff --git a/modules/command.py b/func/minion/modules/command.py
index 5dc0292..06adaaa 100644
--- a/modules/command.py
+++ b/func/minion/modules/command.py
@@ -36,5 +36,3 @@ class Command(func_module.FuncModule):
methods = Command()
register_rpc = methods.register_rpc
-
-
diff --git a/modules/copyfile.py b/func/minion/modules/copyfile.py
index 58b5ea4..a4f91f0 100644
--- a/modules/copyfile.py
+++ b/func/minion/modules/copyfile.py
@@ -27,7 +27,7 @@ class CopyFile(func_module.FuncModule):
"checksum" : self.checksum
}
func_module.FuncModule.__init__(self)
-
+
def checksum(self, thing):
CHUNK=2**16
@@ -54,17 +54,17 @@ class CopyFile(func_module.FuncModule):
# we should probably verify mode,uid,gid are valid as well
-
+
dirpath = os.path.dirname(filepath)
basepath = os.path.basename(filepath)
if not os.path.exists(dirpath):
os.makedirs(dirpath)
-
+
remote_sum = self.checksum(filebuf)
local_sum = 0
if os.path.exists(filepath):
local_sum = self.checksum(filepath)
-
+
if remote_sum != local_sum or force is not None:
# back up the localone
if os.path.exists(filepath):
@@ -90,18 +90,18 @@ class CopyFile(func_module.FuncModule):
os.chown(filepath, uid, gid)
except (IOError, OSError), e:
return -1
-
+
return 1
def _backuplocal(self, fn):
"""
- make a date-marked backup of the specified file,
+ make a date-marked backup of the specified file,
return True or False on success or failure
"""
# backups named basename-YYYY-MM-DD@HH:MM~
ext = time.strftime("%Y-%m-%d@%H:%M~", time.localtime(time.time()))
backupdest = '%s.%s' % (fn, ext)
-
+
try:
shutil.copy2(fn, backupdest)
except shutil.Error, e:
diff --git a/modules/func_module.py b/func/minion/modules/func_module.py
index 32a235d..aa3c132 100755
--- a/modules/func_module.py
+++ b/func/minion/modules/func_module.py
@@ -24,11 +24,11 @@ class FuncModule(object):
version = "0.0.0"
api_version = "0.0.0"
description = "No Description provided"
-
+
def __init__(self):
config_file = '/etc/func/minion.conf'
- self.config = read_config(config_file, FuncdConfig)
+ self.config = read_config(config_file, FuncdConfig)
self.__init_log()
self.__base_methods = {
# __'s so we don't clobber useful names
@@ -37,11 +37,11 @@ class FuncModule(object):
"module_description" : self.__module_description,
"list_methods" : self.__list_methods
}
-
+
def __init_log(self):
log = logger.Logger()
self.logger = log.logger
-
+
def register_rpc(self, handlers, module_name):
# add the internal methods, note that this means they
# can get clobbbered by subclass versions
diff --git a/modules/hardware.py b/func/minion/modules/hardware.py
index e2455d1..79faf4c 100755
--- a/modules/hardware.py
+++ b/func/minion/modules/hardware.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
-##
+##
## Hardware profiler plugin
## requires the "smolt" client package be installed
## but also relies on lspci for some things
@@ -30,7 +30,7 @@ class HardwareModule(func_module.FuncModule):
def __init__(self):
self.methods = {
"info" : self.info,
- "hal_info" : self.hal_info
+ "hal_info" : self.hal_info
}
func_module.FuncModule.__init__(self)
@@ -41,10 +41,10 @@ class HardwareModule(func_module.FuncModule):
"""
cmd = sub_process.Popen(["/usr/bin/lshal"],shell=False,stdout=sub_process.PIPE)
- data = cmd.communicate()[0]
-
+ data = cmd.communicate()[0]
+
data = data.split("\n")
-
+
results = {}
current = ""
label = data[0]
@@ -56,7 +56,7 @@ class HardwareModule(func_module.FuncModule):
else:
if label == "":
label = d
- current = current + d
+ current = current + d
return results
@@ -75,7 +75,7 @@ def hw_info(with_devices=True):
# this may fail if smolt is not installed. That's ok. hal_info will
# still work.
-
+
# hack: smolt is not installed in site-packages
sys.path.append("/usr/share/smolt/client")
import smolt
@@ -92,14 +92,14 @@ def hw_info(with_devices=True):
'cpuModel' : str(host.cpuModel),
'numCpus' : str(host.numCpus),
'cpuSpeed' : str(host.cpuSpeed),
- 'systemMemory' : str(host.systemMemory),
+ 'systemMemory' : str(host.systemMemory),
'systemSwap' : str(host.systemSwap),
'kernelVersion' : str(host.kernelVersion),
'language' : str(host.language),
'platform' : str(host.platform),
'systemVendor' : str(host.systemVendor),
'systemModel' : str(host.systemModel),
- 'formfactor' : str(host.formfactor),
+ 'formfactor' : str(host.formfactor),
'selinux_enabled' : str(host.selinux_enabled),
'selinux_enforce' : str(host.selinux_enforce)
}
@@ -107,7 +107,7 @@ def hw_info(with_devices=True):
# if no hardware info requested, just return the above bits
if not with_devices:
return data
-
+
collection = data["devices"] = []
for item in hardware.deviceIter():
@@ -121,13 +121,10 @@ def hw_info(with_devices=True):
"Bus" : str(Bus),
"Driver" : str(Driver),
"Type" : str(Type),
- "Description" : str(Description)
+ "Description" : str(Description)
})
return data
methods = HardwareModule()
register_rpc = methods.register_rpc
-
-
-
diff --git a/modules/process.py b/func/minion/modules/process.py
index 94a0240..b48b910 100755
--- a/modules/process.py
+++ b/func/minion/modules/process.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
-##
+##
## Process lister (control TBA)
##
## Copyright 2007, Red Hat, Inc
@@ -46,7 +46,7 @@ class ProcessModule(func_module.FuncModule):
cmd = sub_process.Popen(["/bin/ps", flags] ,executable="/bin/ps", stdout=sub_process.PIPE,shell=False)
data = cmd.communicate()[0]
- results = []
+ results = []
for x in data.split("\n"):
tokens = x.split()
@@ -74,6 +74,3 @@ class ProcessModule(func_module.FuncModule):
methods = ProcessModule()
register_rpc = methods.register_rpc
-
-
-
diff --git a/modules/reboot.py b/func/minion/modules/reboot.py
index 8772b8f..8772b8f 100755
--- a/modules/reboot.py
+++ b/func/minion/modules/reboot.py
diff --git a/modules/service.py b/func/minion/modules/service.py
index 433d70b..433d70b 100755
--- a/modules/service.py
+++ b/func/minion/modules/service.py
diff --git a/modules/smart.py b/func/minion/modules/smart.py
index 0a7be47..c65dfb1 100755
--- a/modules/smart.py
+++ b/func/minion/modules/smart.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
-##
+##
## Grabs status from SMART to see if your hard drives are ok
## Returns in the format of (return code, [line1, line2, line3,...])
##
@@ -42,7 +42,7 @@ class SmartModule(func_module.FuncModule):
cmd = sub_process.Popen("/usr/sbin/smartd %s" % flags,stdout=sub_process.PIPE,shell=True)
data = cmd.communicate()[0]
- results = []
+ results = []
for x in data.split("\n"):
results.append(x)
@@ -51,6 +51,3 @@ class SmartModule(func_module.FuncModule):
methods = SmartModule()
register_rpc = methods.register_rpc
-
-
-
diff --git a/modules/test.py b/func/minion/modules/test.py
index 55265a3..55265a3 100755
--- a/modules/test.py
+++ b/func/minion/modules/test.py
diff --git a/modules/virt.py b/func/minion/modules/virt.py
index 18ad718..07a9a87 100755
--- a/modules/virt.py
+++ b/func/minion/modules/virt.py
@@ -15,9 +15,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
"""
# warning: virt management is rather complicated
-# to see a simple example of func, look at the
+# to see a simple example of func, look at the
# service control module. API docs on how
-# to use this to come.
+# to use this to come.
# other modules
import os
@@ -102,7 +102,7 @@ class FuncLibvirtConnection(object):
def create(self, vmid):
return self.find_vm(vmid).create()
-
+
def destroy(self, vmid):
return self.find_vm(vmid).destroy()
@@ -112,8 +112,8 @@ class FuncLibvirtConnection(object):
def get_status2(self, vm):
state = vm.info()[0]
# print "DEBUG: state: %s" % state
- return VIRT_STATE_NAME_MAP.get(state,"unknown")
-
+ return VIRT_STATE_NAME_MAP.get(state,"unknown")
+
def get_status(self, vmid):
state = self.find_vm(vmid).info()[0]
return VIRT_STATE_NAME_MAP.get(state,"unknown")
@@ -121,10 +121,10 @@ class FuncLibvirtConnection(object):
class Virt(func_module.FuncModule):
-
-
+
+
def __init__(self):
-
+
"""
Constructor. Register methods and make them available.
"""
@@ -140,7 +140,7 @@ class Virt(func_module.FuncModule):
"status" : self.get_status,
"list_vms" : self.list_vms,
}
-
+
func_module.FuncModule.__init__(self)
def get_conn(self):
@@ -157,13 +157,13 @@ class Virt(func_module.FuncModule):
except:
pass
return results
-
+
def install(self, server_name, target_name, system=False):
"""
Install a new virt system by way of a named cobbler profile.
"""
-
+
# Example:
# install("bootserver.example.org", "fc7webserver", True)
@@ -192,8 +192,8 @@ class Virt(func_module.FuncModule):
return 0
else:
raise codes.FuncException("koan returned %d" % rc)
-
-
+
+
def shutdown(self, vmid):
"""
Make the machine with the given vmid stop running.
@@ -201,9 +201,9 @@ class Virt(func_module.FuncModule):
"""
self.get_conn()
self.conn.shutdown(vmid)
- return 0
+ return 0
+
-
def pause(self, vmid):
"""
@@ -213,7 +213,7 @@ class Virt(func_module.FuncModule):
self.conn.suspend(vmid)
return 0
-
+
def unpause(self, vmid):
"""
@@ -228,12 +228,12 @@ class Virt(func_module.FuncModule):
def create(self, vmid):
"""
- Start the machine via the given mac address.
+ Start the machine via the given mac address.
"""
self.get_conn()
self.conn.create(vmid)
return 0
-
+
def destroy(self, vmid):
@@ -247,7 +247,7 @@ class Virt(func_module.FuncModule):
def undefine(self, vmid):
-
+
"""
Stop a domain, and then wipe it from the face of the earth.
by deleting the disk image and it's configuration file.
@@ -263,12 +263,10 @@ class Virt(func_module.FuncModule):
"""
Return a state suitable for server consumption. Aka, codes.py values, not XM output.
"""
-
+
self.get_conn()
return self.conn.get_status(vmid)
methods = Virt()
register_rpc = methods.register_rpc
-
-
diff --git a/modules/yum.py b/func/minion/modules/yum.py
index 6600d47..6600d47 100644
--- a/modules/yum.py
+++ b/func/minion/modules/yum.py
diff --git a/minion/server.py b/func/minion/server.py
index 7a11ab8..f155dba 100755
--- a/minion/server.py
+++ b/func/minion/server.py
@@ -35,7 +35,7 @@ import codes
import module_loader
import utils
-
+
class XmlRpcInterface(object):
@@ -53,7 +53,7 @@ class XmlRpcInterface(object):
# need a reference so we can log ip's, certs, etc
# self.server = server
-
+
def __setup_handlers(self):
"""
@@ -80,7 +80,7 @@ class XmlRpcInterface(object):
def list_modules(self):
return self.modules.keys()
-
+
def list_methods(self):
return self.handlers.keys()
@@ -88,12 +88,12 @@ class XmlRpcInterface(object):
if method in self.handlers:
return FuncApiMethod(self.logger, method, self.handlers[method])
-
+
else:
self.logger.info("Unhandled method call for method: %s " % method)
raise codes.InvalidMethodException
-
+
class FuncApiMethod:
@@ -107,7 +107,7 @@ class FuncApiMethod:
self.logger = logger
self.__method = method
self.__name = name
-
+
def __log_exc(self):
"""
@@ -141,7 +141,7 @@ class FuncApiMethod:
def serve():
"""
- Code for starting the XMLRPC service.
+ Code for starting the XMLRPC service.
"""
server =FuncSSLXMLRPCServer(('', 51234))
server.logRequests = 0 # don't print stuff to console
@@ -165,13 +165,13 @@ class FuncSSLXMLRPCServer(AuthedXMLRPCServer.AuthedSSLXMLRPCServer,
def __init__(self, args):
self.allow_reuse_address = True
self.modules = module_loader.load_modules()
-
+
XmlRpcInterface.__init__(self)
hn = socket.getfqdn()
self.key = "%s/%s.pem" % (self.config.cert_dir, hn)
self.cert = "%s/%s.cert" % (self.config.cert_dir, hn)
self.ca = "%s/ca.cert" % self.config.cert_dir
-
+
AuthedXMLRPCServer.AuthedSSLXMLRPCServer.__init__(self, ("", 51234),
self.key, self.cert,
self.ca)
@@ -180,7 +180,7 @@ class FuncSSLXMLRPCServer(AuthedXMLRPCServer.AuthedSSLXMLRPCServer,
"""
the SimpleXMLRPCServer class will call _dispatch if it doesn't
- find a handler method
+ find a handler method
"""
# Recognize ipython's tab completion calls
@@ -194,19 +194,19 @@ class FuncSSLXMLRPCServer(AuthedXMLRPCServer.AuthedSSLXMLRPCServer,
cn = p.get_subject().CN
sub_hash = p.subject_name_hash()
else:
- print 'no cert'
+ print 'no cert'
# XXX FIXME - need to figure out how to dig into the server base classes
# so we can get client ip, and eventually cert id info -akl
self.audit_logger.log_call(ip, cn, sub_hash, method, params)
return self.get_dispatch_method(method)(*params)
-
+
def auth_cb(self, request, client_address):
peer_cert = request.get_peer_certificate()
return peer_cert.get_subject().CN
-
+
def main(argv):
"""
@@ -217,18 +217,16 @@ def main(argv):
utils.daemonize("/var/run/funcd.pid")
else:
print "serving...\n"
-
+
try:
utils.create_minion_keys()
serve()
except codes.FuncException, e:
print >> sys.stderr, 'error: %s' % e
sys.exit(1)
-
+
# ======================================================================================
if __name__ == "__main__":
textdomain(I18N_DOMAIN)
main(sys.argv)
-
-
diff --git a/minion/sub_process.py b/func/minion/sub_process.py
index 7c229dc..7c229dc 100644
--- a/minion/sub_process.py
+++ b/func/minion/sub_process.py
diff --git a/minion/utils.py b/func/minion/utils.py
index 7a6180d..eceb90f 100755
--- a/minion/utils.py
+++ b/func/minion/utils.py
@@ -27,21 +27,21 @@ from func.commonconfig import FuncdConfig
def create_minion_keys():
config_file = '/etc/func/minion.conf'
- config = read_config(config_file, FuncdConfig)
+ config = read_config(config_file, FuncdConfig)
cert_dir = config.cert_dir
master_uri = 'http://%s:51235/' % config.certmaster
hn = socket.getfqdn()
-
+
key_file = '%s/%s.pem' % (cert_dir, hn)
csr_file = '%s/%s.csr' % (cert_dir, hn)
cert_file = '%s/%s.cert' % (cert_dir, hn)
ca_cert_file = '%s/ca.cert' % cert_dir
-
+
if os.path.exists(cert_file) and os.path.exists(ca_cert_file):
return
- keypair = None
+ keypair = None
try:
if not os.path.exists(cert_dir):
os.makedirs(cert_dir)
@@ -53,19 +53,19 @@ def create_minion_keys():
csr = certs.make_csr(keypair, dest=csr_file)
except Exception, e: # need a little more specificity here
raise codes.FuncException, "Could not create local keypair or csr for minion funcd session"
-
+
result = False
while not result:
try:
result, cert_string, ca_cert_string = submit_csr_to_master(csr_file, master_uri)
except socket.gaierror, e:
raise codes.FuncException, "Could not locate certmaster at: http://certmaster:51235/"
-
+
# logging here would be nice
if not result:
- time.sleep(10)
-
-
+ time.sleep(10)
+
+
if result:
cert_fo = open(cert_file, 'w')
cert_fo.write(cert_string)
@@ -74,18 +74,18 @@ def create_minion_keys():
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):
""""
gets us our cert back from the certmaster.wait_for_cert() method
takes csr_file as path location and master_uri
returns Bool, str(cert), str(ca_cert)
"""
-
+
fo = open(csr_file)
csr = fo.read()
s = xmlrpclib.ServerProxy(master_uri)
-
+
return s.wait_for_cert(csr)
diff --git a/overlord/Makefile b/func/overlord/Makefile
index 86a3db8..f2bc6c4 100755
--- a/overlord/Makefile
+++ b/func/overlord/Makefile
@@ -6,14 +6,13 @@ PYCHECKER = /usr/bin/pychecker
PYFLAKES = /usr/bin/pyflakes
clean::
- @rm -fv *.pyc *~ .*~ *.pyo
+ @rm -fv *.pyc *~ .*~ *.pyo
@find . -name .\#\* -exec rm -fv {} \;
@rm -fv *.rpm
-
-pychecker::
+
+pychecker::
@$(PYCHECKER) $(PYFILES) || exit 0
pyflakes::
@$(PYFLAKES) $(PYFILES) || exit 0
-
diff --git a/overlord/__init__.py b/func/overlord/__init__.py
index e69de29..e69de29 100644
--- a/overlord/__init__.py
+++ b/func/overlord/__init__.py
diff --git a/overlord/client.py b/func/overlord/client.py
index 133aafa..3c60148 100755
--- a/overlord/client.py
+++ b/func/overlord/client.py
@@ -6,7 +6,7 @@
## Copyright 2007, Red Hat, Inc
## Michael DeHaan <mdehaan@redhat.com>
## +AUTHORS
-##
+##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
@@ -83,7 +83,7 @@ class Client(object):
self.interactive = interactive
self.noglobs = noglobs
self.servers = self.expand_servers(self.server_spec)
-
+
# default cert/ca/key is the same as the certmaster ca - need to
# be able to change that on the cli
self.key = '%s/funcmaster.key' % self.config.cadir
@@ -131,13 +131,13 @@ class Client(object):
to an unspecified number of machines.
So, it enables stuff like this:
-
+
Client("*.example.org").yum.install("foo")
# WARNING: any missing values in Client's source will yield
# strange errors with this engaged. Be aware of that.
"""
-
+
return CommandAutomagic(self, [name])
# -----------------------------------------------
@@ -170,13 +170,13 @@ class Client(object):
try:
# thats some pretty code right there aint it? -akl
# we can't call "call" on s, since thats a rpc, so
- # we call gettatr around it.
+ # we call gettatr around it.
meth = "%s.%s" % (module, method)
retval = getattr(conn, meth)(*args[:])
if self.interactive:
- pprint.pprint(retval)
+ pprint.pprint(retval)
except Exception, e:
- retval = e
+ retval = e
if self.interactive:
sys.stderr.write("remote exception on %s: %s\n" %
(server, str(e)))
@@ -191,7 +191,7 @@ class Client(object):
return results
- # -----------------------------------------------
+ # -----------------------------------------------
def cli_return(self,results):
"""
@@ -252,7 +252,7 @@ class Call(command.Command):
client = Client(self.server_spec,port=self.port,interactive=True,
verbose=self.verbose, config=self.config)
results = client.run(self.module, self.method, self.method_args)
-
+
# TO DO: add multiplexer support
# probably as a higher level module.
@@ -263,14 +263,14 @@ class FuncCommandLine(command.Command):
useage = "func is the commandline interface to a func minion"
subCommandClasses = [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")
diff --git a/overlord/command.py b/func/overlord/command.py
index 54da1ec..812ad8d 100644
--- a/overlord/command.py
+++ b/func/overlord/command.py
@@ -3,7 +3,7 @@
# This file is released under the standard PSF license.
#
-# from MOAP - https://thomas.apestaart.org/moap/trac
+# from MOAP - https://thomas.apestaart.org/moap/trac
# written by Thomas Vander Stichele (thomas at apestaart dot org)
#
@@ -197,7 +197,7 @@ class Command:
# handle pleas for help
if args and args[0] == 'help':
self.debug('Asked for help, args %r' % args)
-
+
# give help on current command if only 'help' is passed
if len(args) == 1:
self.outputHelp()
diff --git a/overlord/sslclient.py b/func/overlord/sslclient.py
index 0ddbf58..ccb2c9c 100644
--- a/overlord/sslclient.py
+++ b/func/overlord/sslclient.py
@@ -44,15 +44,9 @@ class FuncServer(SSLXMLRPCServerProxy):
self.pem,
self.crt,
self.ca)
-
+
if __name__ == "__main__":
s = SSLXMLRPCServerProxy('https://localhost:51234/', '/etc/pki/func/slave.pem', '/etc/pki/func/slave.cert', '/etc/pki/func/ca/funcmaster.crt')
f = s.ping(1, 2)
print f
-
-
-
-
-
-
diff --git a/overlord/test_func.py b/func/overlord/test_func.py
index 4850675..2b3f041 100644
--- a/overlord/test_func.py
+++ b/func/overlord/test_func.py
@@ -38,7 +38,7 @@ if TEST_PROCESS:
# here's the service module testing
if TEST_SERVICES:
print s.service.restart("httpd")
-
+
if TEST_HARDWARE:
print s.hardware.info()
@@ -58,5 +58,4 @@ if TEST_VIRT:
if status == "shutdown":
s.virt.start(vm)
-# add more tests here
-
+# add more tests here
diff --git a/setup.py b/setup.py
index c908534..41f5553 100644
--- a/setup.py
+++ b/setup.py
@@ -28,10 +28,7 @@ if __name__ == "__main__":
license = "GPL",
scripts = ["scripts/funcd", "scripts/func", "scripts/certmaster", "scripts/certmaster-ca"],
# package_data = { '' : ['*.*'] },
- package_dir = {"%s" % NAME: "%s" % NAME,
- "%s/minion" % NAME: "minion/",
- "%s/minion/modules" % NAME: "modules/",
- "%s/overlord" % NAME: "overlord/"
+ package_dir = {"%s" % NAME: "%s" % NAME
},
packages = ["%s" % NAME,
"%s/minion" % NAME,