diff options
author | Luke Macken <lmacken@redhat.com> | 2008-01-15 19:37:40 -0500 |
---|---|---|
committer | Luke Macken <lmacken@redhat.com> | 2008-01-15 19:37:40 -0500 |
commit | 79d75b06a1bdae8c5c42026de606ed1787be6030 (patch) | |
tree | a465ccc79edb798b51965a42148069955800f0b7 /func/minion/modules | |
parent | edbdbfb8bafd8510976bbc71b1f6672bd2fb5018 (diff) | |
download | func-79d75b06a1bdae8c5c42026de606ed1787be6030.tar.gz func-79d75b06a1bdae8c5c42026de606ed1787be6030.tar.xz func-79d75b06a1bdae8c5c42026de606ed1787be6030.zip |
Fix our FuncModule list_methods
Diffstat (limited to 'func/minion/modules')
-rw-r--r-- | func/minion/modules/func_module.py | 16 |
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 |