diff options
| author | Seth Vidal <skvidal@fedoraproject.org> | 2007-10-03 07:56:21 -0400 |
|---|---|---|
| committer | Seth Vidal <skvidal@fedoraproject.org> | 2007-10-03 07:56:21 -0400 |
| commit | cccce6ade18ec60ea3e5418e14f8187b3a8f789a (patch) | |
| tree | 2a18667d0d9b47682a67a3076cfdf91e5a8c923e /func/minion/modules/func_module.py | |
| parent | 66fc8600c90f5308a11de6895650441743396c8c (diff) | |
| parent | 63e937cf144f0c61811bb6d842cfc22838a6b851 (diff) | |
| download | third_party-func-cccce6ade18ec60ea3e5418e14f8187b3a8f789a.tar.gz third_party-func-cccce6ade18ec60ea3e5418e14f8187b3a8f789a.tar.xz third_party-func-cccce6ade18ec60ea3e5418e14f8187b3a8f789a.zip | |
Merge branch 'master' of ssh://git.fedoraproject.org/git/hosted/func
* 'master' of ssh://git.fedoraproject.org/git/hosted/func:
Fix up recursive pylint and pychecker rules.
Moved code under the func namespace.
Exit program after listing minions.
Added func --list-minions option.
changes to use the new command line modules
add command.py from MOAP http://thomas.apestaart.org/moap/trac
Diffstat (limited to 'func/minion/modules/func_module.py')
| -rwxr-xr-x | func/minion/modules/func_module.py | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/func/minion/modules/func_module.py b/func/minion/modules/func_module.py new file mode 100755 index 0000000..aa3c132 --- /dev/null +++ b/func/minion/modules/func_module.py @@ -0,0 +1,67 @@ +#!/usr/bin/python + +## +## 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. +## + + +from func import logger +from func.config import read_config +from func.commonconfig import FuncdConfig + + +class FuncModule(object): + + # the version is meant to + 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.__init_log() + self.__base_methods = { + # __'s so we don't clobber useful names + "module_version" : self.__module_version, + "module_api_version" : self.__module_api_version, + "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 + for meth in self.__base_methods: + handlers["%s.%s" % (module_name, meth)] = self.__base_methods[meth] + for meth in self.methods: + handlers["%s.%s" % (module_name,meth)] = self.methods[meth] + + def __list_methods(self): + return self.methods.keys() + self.__base_methods.keys() + + def __module_version(self): + return self.version + + def __module_api_version(self): + return self.api_version + + def __module_description(self): + return self.description + + +methods = FuncModule() +register_rpc = methods.register_rpc |
