summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clusterman/__main__.py14
-rw-r--r--clusterman/commands/plugins.py7
-rw-r--r--clusterman/config.py2
3 files changed, 17 insertions, 6 deletions
diff --git a/clusterman/__main__.py b/clusterman/__main__.py
index c133027..35953b4 100644
--- a/clusterman/__main__.py
+++ b/clusterman/__main__.py
@@ -1,6 +1,6 @@
import argparse,sys
from clusterman.config import *
-from clusterman.commands import node
+from clusterman.commands import node, plugins
def main():
parser = argparse.ArgumentParser()
@@ -21,6 +21,10 @@ def main():
##### Frontend commands #####
target_frontend = subparsers.add_parser("frontend")
+ ##### Plugins commands #####
+ target_plugins = subparsers.add_parser("plugins")
+ target_plugins.add_argument("name", help="Plugin's name")
+ target_plugins.add_argument("parameters", help="Plugin's parameters",nargs=argparse.REMAINDER)
# Check if command specified:
if len(sys.argv)==1:
@@ -45,11 +49,11 @@ def main():
node.ls()
else:
target_node.print_help(sys.stderr)
- sys.exit(1)
-
- if args.target == "frontend":
+ sys.exit(1)
+ elif args.target == "frontend":
print("Do frontend related stuff")
-
+ elif args.target == "plugins":
+ plugins.execute(args.name,args.parameters)
diff --git a/clusterman/commands/plugins.py b/clusterman/commands/plugins.py
new file mode 100644
index 0000000..caed02a
--- /dev/null
+++ b/clusterman/commands/plugins.py
@@ -0,0 +1,7 @@
+import os
+from clusterman.config import CONF
+
+
+def execute(name,args):
+ executable=CONF["plugins"][name]
+ os.system(executable+" "+" ".join(args))
diff --git a/clusterman/config.py b/clusterman/config.py
index 804a2cc..645f4d1 100644
--- a/clusterman/config.py
+++ b/clusterman/config.py
@@ -13,7 +13,7 @@ class Config:
"ip4_to": "10.128.0.140",
"ip4_ignore": ["10.0.0.5", "10.0.0.1"],
},
- "plugins": [],
+ "plugins": { "ls": "ls -al" },
"timeout": 0.5
}