From 1eeae06a1fbc6d9b98baa3445d889854aef589cf Mon Sep 17 00:00:00 2001 From: "jose.lausuch" Date: Mon, 18 May 2015 12:15:59 +0200 Subject: config_functest.py : added --force flag to force clean functest without prompting. JIRA: FUNCTEST-10 Change-Id: I5798333db7e24674abaa80b9740e20fa7a29a747 Signed-off-by: jose.lausuch --- testcases/config_functest.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'testcases') diff --git a/testcases/config_functest.py b/testcases/config_functest.py index 85b6f43dc..7f3da43f4 100644 --- a/testcases/config_functest.py +++ b/testcases/config_functest.py @@ -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) -- cgit 1.2.3-korg