summaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authorLuke Macken <lmacken@redhat.com>2008-01-15 19:37:40 -0500
committerLuke Macken <lmacken@redhat.com>2008-01-15 19:37:40 -0500
commit79d75b06a1bdae8c5c42026de606ed1787be6030 (patch)
treea465ccc79edb798b51965a42148069955800f0b7 /func
parentedbdbfb8bafd8510976bbc71b1f6672bd2fb5018 (diff)
downloadthird_party-func-79d75b06a1bdae8c5c42026de606ed1787be6030.tar.gz
third_party-func-79d75b06a1bdae8c5c42026de606ed1787be6030.tar.xz
third_party-func-79d75b06a1bdae8c5c42026de606ed1787be6030.zip
Fix our FuncModule list_methods
Diffstat (limited to 'func')
-rw-r--r--func/minion/modules/func_module.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/func/minion/modules/func_module.py b/func/minion/modules/func_module.py
index 99758f9..7d476dc 100644
--- a/func/minion/modules/func_module.py
+++ b/func/minion/modules/func_module.py
@@ -47,14 +47,24 @@ class FuncModule(object):
for meth in self.__base_methods:
handlers["%s.%s" % (module_name, meth)] = self.__base_methods[meth]
- # register all methods that don't start with an underscore
+ # register our module's handlers
+ for name, handler in self.__list_handlers().items():
+ handlers["%s.%s" % (module_name, name)] = handler
+
+ def __list_handlers(self):
+ """ Return a dict of { handler_name, method, ... }.
+ All methods that do not being with an underscore will be exposed.
+ We also make sure to not expose our register_rpc method.
+ """
+ handlers = {}
for attr in dir(self):
if inspect.ismethod(getattr(self, attr)) and attr[0] != '_' and \
attr != 'register_rpc':
- handlers["%s.%s" % (module_name, attr)] = getattr(self, attr)
+ handlers[attr] = getattr(self, attr)
+ return handlers
def __list_methods(self):
- return self.methods.keys() + self.__base_methods.keys()
+ return self.__list_handlers().keys() + self.__base_methods.keys()
def __module_version(self):
return self.version