From 4919b0f1a128fc5c5fd18c51964b5c75569d5503 Mon Sep 17 00:00:00 2001 From: boucherv Date: Tue, 5 Jan 2016 11:43:09 +0100 Subject: Ensure no ssh key file already exists before launch cloudify deployment JIRA: FUNCTEST-115 Change-Id: Icef3da22f8cd4a528bd466d955037a9f37864f9b Signed-off-by: boucherv --- testcases/vIMS/CI/orchestrator.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'testcases/vIMS') diff --git a/testcases/vIMS/CI/orchestrator.py b/testcases/vIMS/CI/orchestrator.py index 409b3e0cb..729e67881 100644 --- a/testcases/vIMS/CI/orchestrator.py +++ b/testcases/vIMS/CI/orchestrator.py @@ -72,8 +72,17 @@ class orchestrator: f.write(yaml.dump(self.config, default_style='"') ) f.close() - if self.logger: + # Ensure no ssh key file already exists + key_files = ["/.ssh/cloudify-manager-kp.pem", "/.ssh/cloudify-agent-kp.pem"] + home = os.path.expanduser("~") + + for key_file in key_files: + if os.path.isfile(home + key_file): + os.remove(home + key_file) + + if self.logger: self.logger.info("Launching the cloudify-manager deployment") + script = "source " + self.testcase_dir + "venv_cloudify/bin/activate; " script += "cd " + self.testcase_dir + "; " script += "cfy init -r; " @@ -97,7 +106,7 @@ class orchestrator: script = "source " + self.testcase_dir + "venv_cloudify/bin/activate; " script += "cd " + self.testcase_dir + "; " - script += "cfy teardown -f; " + script += "cfy teardown -f --ignore-deployments=True; " cmd = "/bin/bash -c '" + script + "'" execute_command(cmd, self.logger) @@ -144,7 +153,10 @@ class orchestrator: script += "cfy deployments delete -d " + dep_name + "; " cmd = "/bin/bash -c '" + script + "'" - execute_command(cmd, self.logger) + try: + execute_command(cmd, self.logger) + except: + logger.error("Clearwater undeployment failed") def execute_command(cmd, logger): -- cgit 1.2.3-korg