config_functest.py : added --force flag to force clean functest without prompting.
authorjose.lausuch <jose.lausuch@ericsson.com>
Mon, 18 May 2015 10:15:59 +0000 (12:15 +0200)
committerjose.lausuch <jose.lausuch@ericsson.com>
Mon, 18 May 2015 10:20:16 +0000 (12:20 +0200)
JIRA: FUNCTEST-10

Change-Id: I5798333db7e24674abaa80b9740e20fa7a29a747
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
testcases/config_functest.py

index 85b6f43..7f3da43 100644 (file)
@@ -14,12 +14,10 @@ from git import Repo
 from neutronclient.v2_0 import client
 
 actions = ['start', 'check', 'clean']
-
-
-
 parser = argparse.ArgumentParser()
 parser.add_argument("action", help="Possible actions are: '{d[0]}|{d[1]}|{d[2]}' ".format(d=actions))
 parser.add_argument("-d", "--debug", help="Debug mode",  action="store_true")
+parser.add_argument("-f", "--force", help="Force",  action="store_true")
 args = parser.parse_args()
 
 
@@ -33,6 +31,7 @@ if args.debug:
 else:
     ch.setLevel(logging.INFO)
 
+
 formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
 ch.setFormatter(formatter)
 logger.addHandler(ch)
@@ -621,16 +620,19 @@ def main():
             logger.info("Functest environment not found or faulty")
 
     if args.action == "clean":
-        while True:
-            print("Are you sure? [y|n]")
-            answer = raw_input("")
-            if answer == "y":
-                config_functest_clean()
-                break
-            elif answer == "n":
-                break
-            else:
-                print("Invalid option.")
+        if args.force :
+            config_functest_clean()
+        else :
+            while True:
+                print("Are you sure? [y|n]")
+                answer = raw_input("")
+                if answer == "y":
+                    config_functest_clean()
+                    break
+                elif answer == "n":
+                    break
+                else:
+                    print("Invalid option.")
     exit(0)