[PATCH] lnst-ctl: Output usage when no action was specified

Radek Pazdera rpazdera at redhat.com
Fri Aug 30 12:49:38 UTC 2013


This commit fixes Issue #6.

Signed-off-by: Radek Pazdera <rpazdera at redhat.com>
---
 lnst-ctl | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lnst-ctl b/lnst-ctl
index 39bb5cf..55e2dd1 100755
--- a/lnst-ctl
+++ b/lnst-ctl
@@ -58,9 +58,6 @@ def process_recipe(action, file_path, cleanup, res_serializer,
         return nettestctl.config_only_recipe()
     elif action == "match_setup":
         return nettestctl.match_setup()
-    else:
-        logging.error("Unknown action \"%s\"" % action)
-        usage();
 
 def get_recipe_result(args, file_path, cleanup, res_serializer, packet_capture,
                       log_ctl, pool_checks):
@@ -144,11 +141,14 @@ def main():
                      log_dir=lnst_config.get_option('environment', 'log_dir'),
                      log_subdir=date, colours=coloured_output)
 
-    action = args.pop()
+    if len(args) <= 0:
+        logging.error("No action specified")
+        usage()
 
+    action = args.pop()
     if not action in ['run', 'dump', 'config_only', 'match_setup']:
-        logging.error("No action command passed")
-        usage();
+        logging.error("Action '%s' not recognised" % action)
+        usage()
 
     summary = []
 
-- 
1.8.3.1



More information about the LNST-developers mailing list