diff options
author | jose.lausuch <jose.lausuch@ericsson.com> | 2015-05-18 12:15:59 +0200 |
---|---|---|
committer | jose.lausuch <jose.lausuch@ericsson.com> | 2015-05-18 12:20:16 +0200 |
commit | 1eeae06a1fbc6d9b98baa3445d889854aef589cf (patch) | |
tree | 59128f7de5968d1b52987ddaab4eb8a81e480e36 | |
parent | 4080c9c890f314947c8e523141b29664682f2e46 (diff) |
config_functest.py : added --force flag to force clean functest without prompting.
JIRA: FUNCTEST-10
Change-Id: I5798333db7e24674abaa80b9740e20fa7a29a747
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
-rw-r--r-- | testcases/config_functest.py | 28 |
1 files changed, 15 insertions, 13 deletions
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) |