summaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authorSteve 'Ashcrow' Milner <stevem@gnulinux.net>2008-01-13 14:35:45 -0500
committerSteve 'Ashcrow' Milner <stevem@gnulinux.net>2008-01-13 14:35:45 -0500
commitb77fbdd90f46b3d1602aa43e99abec096d93888e (patch)
tree9d8ac00601e056ac79f5679b88cc19bb65293190 /func
parent63170952d465a8acf8355e7b346733e4f6ddcace (diff)
downloadfunc-b77fbdd90f46b3d1602aa43e99abec096d93888e.tar.gz
func-b77fbdd90f46b3d1602aa43e99abec096d93888e.tar.xz
func-b77fbdd90f46b3d1602aa43e99abec096d93888e.zip
removed a lot of misplaced shebangs.
Diffstat (limited to 'func')
-rw-r--r--func/certs.py13
-rwxr-xr-xfunc/codes.py2
-rw-r--r--func/commonconfig.py4
-rw-r--r--func/config.py14
-rwxr-xr-xfunc/logger.py5
-rwxr-xr-xfunc/minion/codes.py3
-rwxr-xr-xfunc/minion/module_loader.py2
-rw-r--r--func/minion/modules/filetracker.py2
-rw-r--r--[-rwxr-xr-x]func/minion/modules/func_module.py2
-rw-r--r--[-rwxr-xr-x]func/minion/modules/hardware.py2
-rw-r--r--func/minion/modules/mount.py2
-rw-r--r--[-rwxr-xr-x]func/minion/modules/process.py2
-rw-r--r--[-rwxr-xr-x]func/minion/modules/reboot.py0
-rw-r--r--[-rwxr-xr-x]func/minion/modules/service.py2
-rw-r--r--[-rwxr-xr-x]func/minion/modules/smart.py2
-rw-r--r--[-rwxr-xr-x]func/minion/modules/test.py2
-rw-r--r--[-rwxr-xr-x]func/minion/modules/virt.py2
-rwxr-xr-xfunc/minion/utils.py7
-rw-r--r--func/overlord/cmd_modules/ping.py8
-rw-r--r--func/overlord/cmd_modules/show.py5
-rw-r--r--func/overlord/func_command.py2
-rwxr-xr-xfunc/overlord/inventory.py6
-rwxr-xr-x[-rw-r--r--]func/overlord/sslclient.py0
-rwxr-xr-x[-rw-r--r--]func/overlord/test_func.py0
-rwxr-xr-xfunc/utils.py5
25 files changed, 28 insertions, 66 deletions
diff --git a/func/certs.py b/func/certs.py
index 6e3a025..e454cc4 100644
--- a/func/certs.py
+++ b/func/certs.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python -tt
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@@ -25,6 +24,7 @@ def_local = 'Func-ytown'
def_org = 'func'
def_ou = 'slave-key'
+
def make_keypair(dest=None):
pkey = crypto.PKey()
pkey.generate_key(crypto.TYPE_RSA, 2048)
@@ -35,6 +35,7 @@ def make_keypair(dest=None):
return pkey
+
def make_csr(pkey, dest=None, cn=None):
req = crypto.X509Req()
req.get_subject()
@@ -59,11 +60,13 @@ def make_csr(pkey, dest=None, cn=None):
return req
+
def retrieve_key_from_file(keyfile):
fo = open(keyfile, 'r')
buf = fo.read()
keypair = crypto.load_privatekey(crypto.FILETYPE_PEM, buf)
return keypair
+
def retrieve_csr_from_file(csrfile):
fo = open(csrfile, 'r')
@@ -71,12 +74,14 @@ def retrieve_csr_from_file(csrfile):
csrreq = crypto.load_certificate_request(crypto.FILETYPE_PEM, buf)
return csrreq
+
def retrieve_cert_from_file(certfile):
fo = open(certfile, 'r')
buf = fo.read()
cert = crypto.load_certificate(crypto.FILETYPE_PEM, buf)
return cert
+
def create_ca(CN="Func Certificate Authority", ca_key_file=None, ca_cert_file=None):
cakey = make_keypair(dest=ca_key_file)
careq = make_csr(cakey, cn=CN)
@@ -92,7 +97,8 @@ def create_ca(CN="Func Certificate Authority", ca_key_file=None, ca_cert_file=No
destfo = open(ca_cert_file, 'w')
destfo.write(crypto.dump_certificate(crypto.FILETYPE_PEM, cacert))
destfo.close()
-
+
+
def _get_serial_number(cadir):
serial = '%s/serial.txt' % cadir
i = 1
@@ -108,6 +114,7 @@ def _get_serial_number(cadir):
_set_serial_number(cadir, i)
return i
+
def _set_serial_number(cadir, last):
serial = '%s/serial.txt' % cadir
f = open(serial, 'w')
@@ -115,7 +122,6 @@ def _set_serial_number(cadir, last):
f.close()
-
def create_slave_certificate(csr, cakey, cacert, cadir, slave_cert_file=None):
cert = crypto.X509()
cert.set_serial_number(_get_serial_number(cadir))
@@ -130,4 +136,3 @@ def create_slave_certificate(csr, cakey, cacert, cadir, slave_cert_file=None):
destfo.write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert))
destfo.close()
return cert
-
diff --git a/func/codes.py b/func/codes.py
index 058ca44..c6bcb61 100755
--- a/func/codes.py
+++ b/func/codes.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
"""
func
@@ -19,6 +18,7 @@ import exceptions
class FuncException(exceptions.Exception):
pass
+
class InvalidMethodException(FuncException):
pass
diff --git a/func/commonconfig.py b/func/commonconfig.py
index 5c3485f..9fd3356 100644
--- a/func/commonconfig.py
+++ b/func/commonconfig.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
from config import BaseConfig, BoolOption, IntOption, Option
class CMConfig(BaseConfig):
@@ -9,9 +7,9 @@ class CMConfig(BaseConfig):
csrroot = Option('/var/lib/func/certmaster/csrs')
autosign = BoolOption(False)
+
class FuncdConfig(BaseConfig):
log_level = Option('INFO')
certmaster = Option('certmaster')
cert_dir = Option('/etc/pki/func')
acl_dir = Option('/etc/func/minion-acl.d')
-
diff --git a/func/config.py b/func/config.py
index 6dbdc61..8202457 100644
--- a/func/config.py
+++ b/func/config.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python -t
-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@@ -34,7 +32,8 @@ class ConfigError(exceptions.Exception):
self.value = value
def __str__(self):
return "%s" %(self.value,)
-
+
+
class Option(object):
'''
This class handles a single Yum configuration file option. Create
@@ -123,6 +122,7 @@ class Option(object):
'''
return str(value)
+
def Inherit(option_obj):
'''Clone an Option instance for the purposes of inheritance. The returned
instance has all the same properties as the input Option and shares items
@@ -136,6 +136,7 @@ def Inherit(option_obj):
new_option.inherit = True
return new_option
+
class ListOption(Option):
def __init__(self, default=None):
@@ -157,6 +158,7 @@ class ListOption(Option):
def tostring(self, value):
return '\n '.join(value)
+
class UrlOption(Option):
'''
This option handles lists of URLs with validation of the URL scheme.
@@ -195,6 +197,7 @@ class UrlOption(Option):
else:
return '%s or %s' % (', '.join(self.schemes[:-1]), self.schemes[-1])
+
class UrlListOption(ListOption):
'''
Option for handling lists of URLs with validation of the URL scheme.
@@ -220,6 +223,7 @@ class IntOption(Option):
except (ValueError, TypeError), e:
raise ValueError('invalid integer value')
+
class BoolOption(Option):
def parse(self, s):
s = s.lower()
@@ -236,6 +240,7 @@ class BoolOption(Option):
else:
return "0"
+
class FloatOption(Option):
def parse(self, s):
try:
@@ -243,6 +248,7 @@ class FloatOption(Option):
except (ValueError, TypeError):
raise ValueError('invalid float value')
+
class SelectionOption(Option):
'''Handles string values where only specific values are allowed
'''
@@ -303,6 +309,7 @@ class BytesOption(Option):
return int(n * mult)
+
class ThrottleOption(BytesOption):
def parse(self, s):
@@ -457,6 +464,7 @@ class BaseConfig(object):
else:
raise ConfigError, 'No such option %s' % option
+
def read_config(config_file, BaseConfigDerived):
confparser = ConfigParser()
opts = BaseConfigDerived()
diff --git a/func/logger.py b/func/logger.py
index 94df311..e679f3d 100755
--- a/func/logger.py
+++ b/func/logger.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
## func
##
## Copyright 2007, Red Hat, Inc
@@ -76,6 +74,3 @@ class AuditLogger(Singleton):
handler.setFormatter(formatter)
self.logger.addHandler(handler)
self._no_handlers = False
-
-
-
diff --git a/func/minion/codes.py b/func/minion/codes.py
index 3d83668..a20c95e 100755
--- a/func/minion/codes.py
+++ b/func/minion/codes.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
"""
func
@@ -19,9 +18,11 @@ import exceptions
class FuncException(exceptions.Exception):
pass
+
class InvalidMethodException(FuncException):
pass
+
class AccessToMethodDenied(FuncException):
pass
diff --git a/func/minion/module_loader.py b/func/minion/module_loader.py
index b29f57c..611323d 100755
--- a/func/minion/module_loader.py
+++ b/func/minion/module_loader.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
## func
##
## Copyright 2007, Red Hat, Inc
diff --git a/func/minion/modules/filetracker.py b/func/minion/modules/filetracker.py
index 368b3b5..0aa4a49 100644
--- a/func/minion/modules/filetracker.py
+++ b/func/minion/modules/filetracker.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
## func
##
## filetracker
diff --git a/func/minion/modules/func_module.py b/func/minion/modules/func_module.py
index aa3c132..5965e24 100755..100644
--- a/func/minion/modules/func_module.py
+++ b/func/minion/modules/func_module.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
diff --git a/func/minion/modules/hardware.py b/func/minion/modules/hardware.py
index 6c44b39..acf5988 100755..100644
--- a/func/minion/modules/hardware.py
+++ b/func/minion/modules/hardware.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
##
## Hardware profiler plugin
## requires the "smolt" client package be installed
diff --git a/func/minion/modules/mount.py b/func/minion/modules/mount.py
index 01e4eab..e8e41ce 100644
--- a/func/minion/modules/mount.py
+++ b/func/minion/modules/mount.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
##
## Mount manager
##
diff --git a/func/minion/modules/process.py b/func/minion/modules/process.py
index 4659772..4c75251 100755..100644
--- a/func/minion/modules/process.py
+++ b/func/minion/modules/process.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
##
## Process lister (control TBA)
##
diff --git a/func/minion/modules/reboot.py b/func/minion/modules/reboot.py
index 8772b8f..8772b8f 100755..100644
--- a/func/minion/modules/reboot.py
+++ b/func/minion/modules/reboot.py
diff --git a/func/minion/modules/service.py b/func/minion/modules/service.py
index 3d3e4a9..d088907 100755..100644
--- a/func/minion/modules/service.py
+++ b/func/minion/modules/service.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
## func
##
## Copyright 2007, Red Hat, Inc
diff --git a/func/minion/modules/smart.py b/func/minion/modules/smart.py
index ca8f301..e85b90c 100755..100644
--- a/func/minion/modules/smart.py
+++ b/func/minion/modules/smart.py
@@ -1,5 +1,3 @@
-#!/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,...])
diff --git a/func/minion/modules/test.py b/func/minion/modules/test.py
index f900326..3a8c33e 100755..100644
--- a/func/minion/modules/test.py
+++ b/func/minion/modules/test.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
from modules import func_module
class Test(func_module.FuncModule):
diff --git a/func/minion/modules/virt.py b/func/minion/modules/virt.py
index 747ba04..ba888ec 100755..100644
--- a/func/minion/modules/virt.py
+++ b/func/minion/modules/virt.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
"""
Virt management features
diff --git a/func/minion/utils.py b/func/minion/utils.py
index 7599657..9b0c96a 100755
--- a/func/minion/utils.py
+++ b/func/minion/utils.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
"""
Copyright 2007, Red Hat, Inc
see AUTHORS
@@ -197,8 +195,3 @@ def get_acls_from_config(acldir='/etc/func/minion-acl.d'):
acls[host].extend(methods)
return acls
-
-
-
-
-
diff --git a/func/overlord/cmd_modules/ping.py b/func/overlord/cmd_modules/ping.py
index 29fa9d0..397adc8 100644
--- a/func/overlord/cmd_modules/ping.py
+++ b/func/overlord/cmd_modules/ping.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
"""
copyfile command line
@@ -15,7 +13,6 @@ 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
@@ -28,11 +25,11 @@ 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"
useage = "see what func minions are up/accessible"
-
def addOptions(self):
"""
Not too many options for you! (Seriously, it's a simple command ... func "*" ping)
@@ -43,14 +40,12 @@ class Ping(client.command.Command):
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
@@ -72,4 +67,3 @@ class Ping(client.command.Command):
print "[ FAILED ] %s" % server
return 1
-
diff --git a/func/overlord/cmd_modules/show.py b/func/overlord/cmd_modules/show.py
index 9582e0d..4a26a75 100644
--- a/func/overlord/cmd_modules/show.py
+++ b/func/overlord/cmd_modules/show.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
"""
show introspection commandline
@@ -73,6 +71,7 @@ class ShowHardware(client.command.Command):
if arg in minion_data:
print minion_data[arg]
+
class Show(client.command.Command):
name = "show"
useage = "various simple report stuff"
@@ -98,5 +97,3 @@ class Show(client.command.Command):
def do(self, args):
pass
-
-
diff --git a/func/overlord/func_command.py b/func/overlord/func_command.py
index 7b491f7..76b4e95 100644
--- a/func/overlord/func_command.py
+++ b/func/overlord/func_command.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
import glob
import sys
diff --git a/func/overlord/inventory.py b/func/overlord/inventory.py
index f36ff69..aafc764 100755
--- a/func/overlord/inventory.py
+++ b/func/overlord/inventory.py
@@ -1,5 +1,4 @@
#!/usr/bin/python
-
##
## func inventory app.
## use func to collect inventory data on anything, yes, anything
@@ -30,6 +29,7 @@ import func.overlord.client as func_client
DEFAULT_TREE = "/var/lib/func/inventory/"
+
class FuncInventory(object):
def __init__(self):
@@ -81,8 +81,6 @@ class FuncInventory(object):
# see what modules each host provides (as well as what hosts we have)
host_methods = func_client.Client(options.server_spec).system.list_methods()
-
-
# call all remote info methods and handle them
if options.verbose:
# print "- DEBUG: %s" % host_methods
@@ -186,8 +184,8 @@ class FuncInventory(object):
# FIXME: check rc's
os.chdir(cwd)
+
if __name__ == "__main__":
inv = FuncInventory()
inv.run(sys.argv)
-
diff --git a/func/overlord/sslclient.py b/func/overlord/sslclient.py
index ccb2c9c..ccb2c9c 100644..100755
--- a/func/overlord/sslclient.py
+++ b/func/overlord/sslclient.py
diff --git a/func/overlord/test_func.py b/func/overlord/test_func.py
index 2b3f041..2b3f041 100644..100755
--- a/func/overlord/test_func.py
+++ b/func/overlord/test_func.py
diff --git a/func/utils.py b/func/utils.py
index de08ba9..4149885 100755
--- a/func/utils.py
+++ b/func/utils.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-
"""
Copyright 2007, Red Hat, Inc
see AUTHORS
@@ -18,7 +16,6 @@ import sys
import traceback
-
# this is kind of handy, so keep it around for now
# but we really need to fix out server side logging and error
# reporting so we don't need it
@@ -47,5 +44,3 @@ def daemonize(pidfile=None):
if pidfile is not None:
open(pidfile, "w").write(str(pid))
sys.exit(0)
-
-