summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--func/minion/modules/networktest.py16
-rwxr-xr-xscripts/func-create-module11
2 files changed, 11 insertions, 16 deletions
diff --git a/func/minion/modules/networktest.py b/func/minion/modules/networktest.py
index e88c169..ed2f3ab 100644
--- a/func/minion/modules/networktest.py
+++ b/func/minion/modules/networktest.py
@@ -9,23 +9,13 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-from modules import func_module
+import func_module
from codes import FuncException
import sub_process
class NetworkTest(func_module.FuncModule):
- def __init__(self):
- self.methods = {
- "ping" : self.ping,
- "netstat" : self.netstat,
- "traceroute" : self.traceroute,
- "dig" : self.dig,
- "isportopen" : self.isportopen,
- }
- func_module.FuncModule.__init__(self)
-
def ping(self, *args):
if '-c' not in args:
raise(FuncException("You must define a count with -c!"))
@@ -58,7 +48,3 @@ class NetworkTest(func_module.FuncModule):
full_cmd = [command] + opts
cmd = sub_process.Popen(full_cmd, stdout=sub_process.PIPE)
return [line for line in cmd.communicate()[0].split('\n')]
-
-
-methods = NetworkTest()
-register_rpc = methods.register_rpc
diff --git a/scripts/func-create-module b/scripts/func-create-module
index 7cbf9eb..cf05449 100755
--- a/scripts/func-create-module
+++ b/scripts/func-create-module
@@ -22,6 +22,15 @@ class %s(func_module.FuncModule):
%s
"""
+METHOD_TEMPLATE = '''\
+ def %s(self):
+ """
+ TODO: Document me ...
+ """
+ pass
+
+'''
+
def populate_template(module_name, desc, methods):
"""
@@ -29,7 +38,7 @@ def populate_template(module_name, desc, methods):
"""
actual_methods = ""
for method in methods:
- actual_methods += " def %s(self):\n pass\n\n" % method
+ actual_methods += METHOD_TEMPLATE % method
return TEMPLATE % (module_name, desc, actual_methods[:-2])