[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lnst-developers
Subject:    [PATCH v2 3/6] lnst-ctl: accept multiple -c options
From:       olichtne () redhat ! com
Date:       2015-02-20 15:48:27
Message-ID: 1424447310-32626-3-git-send-email-olichtne () redhat ! com
[Download RAW message or body]

From: Ondrej Lichtner <olichtne@redhat.com>

The option -c (--config) can now be specified multiple times. This is
usefull when running lnst-ctl from a script.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
---
 lnst-ctl | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/lnst-ctl b/lnst-ctl
index e715bb8..9a321b6 100755
--- a/lnst-ctl
+++ b/lnst-ctl
@@ -226,7 +226,6 @@ def main():
     result_path = None
     html_result_path = None
     xslt_url = None
-    config_path = None
     packet_capture = False
     pool_checks = True
     coloured_output = True
@@ -241,7 +240,11 @@ def main():
         elif opt in ("-h", "--help"):
             usage(RETVAL_PASS)
         elif opt in ("-c", "--config"):
-            config_path = arg
+            if not os.path.isfile(arg):
+                print "File '%s' doesn't exist!" % arg
+                usage(RETVAL_ERR)
+            else:
+                lnst_config.load_config(arg)
         elif opt in ("-x", "--result"):
             result_path = arg
         elif opt in ("-t", "--html"):
@@ -265,12 +268,6 @@ def main():
         elif opt in ("--dump-config"):
             dump_config = True
 
-    if config_path is not None:
-        if not os.path.isfile(config_path):
-            print "File '%s' doesn't exist!" % config_path
-            usage(RETVAL_ERR)
-        else:
-            lnst_config.load_config(config_path)
 
     if xslt_url != None:
         lnst_config.set_option("environment", "xslt_url", xslt_url)
-- 
2.1.0

_______________________________________________
LNST-developers mailing list
LNST-developers@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/lnst-developers

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic