From 101000ae41d7391c4fa10f65835cffc72ad9f543 Mon Sep 17 00:00:00 2001 From: Juha Kosonen Date: Fri, 7 Sep 2018 13:54:38 +0300 Subject: Do not raise exceptions in conf_utils Return a reasonable value for caller to process. Change-Id: I5a83544aaebb4e53db37ddaa13033d77848722b8 Signed-off-by: Juha Kosonen --- functest/opnfv_tests/openstack/tempest/conf_utils.py | 14 ++++---------- functest/opnfv_tests/openstack/tempest/tempest.py | 13 +++++++++---- 2 files changed, 13 insertions(+), 14 deletions(-) (limited to 'functest/opnfv_tests/openstack/tempest') diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py index 80f78e979..d3f7a7b1f 100644 --- a/functest/opnfv_tests/openstack/tempest/conf_utils.py +++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py @@ -81,6 +81,7 @@ def create_rally_deployment(environ=None): cmd = ['rally', 'deployment', 'check'] output = subprocess.check_output(cmd) LOGGER.info("%s\n%s", " ".join(cmd), output) + return get_verifier_deployment_id() def create_verifier(): @@ -101,6 +102,7 @@ def create_verifier(): '--type', 'tempest', '--system-wide'] output = subprocess.check_output(cmd) LOGGER.info("%s\n%s", " ".join(cmd), output) + return get_verifier_id() def get_verifier_id(): @@ -114,9 +116,6 @@ def get_verifier_id(): stdout=subprocess.PIPE, stderr=subprocess.STDOUT) verifier_uuid = proc.stdout.readline().rstrip() - if verifier_uuid == "": - LOGGER.error("Tempest verifier not found.") - raise Exception('Error with command:%s' % cmd) return verifier_uuid @@ -131,9 +130,6 @@ def get_verifier_deployment_id(): stdout=subprocess.PIPE, stderr=subprocess.STDOUT) deployment_uuid = proc.stdout.readline().rstrip() - if deployment_uuid == "": - LOGGER.error("Rally deployment not found.") - raise Exception('Error with command:%s' % cmd) return deployment_uuid @@ -261,10 +257,8 @@ def configure_verifier(deployment_dir): if not os.path.isfile(tempest_conf_file): LOGGER.error("Tempest configuration file %s NOT found.", tempest_conf_file) - raise Exception("Tempest configuration file %s NOT found." - % tempest_conf_file) - else: - return tempest_conf_file + return None + return tempest_conf_file def convert_dict_to_ini(value): diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index f30bbc552..a11d132dd 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -62,12 +62,15 @@ class TempestCommon(singlevm.VmReady2): OS_PROJECT_NAME=self.project.project.name, OS_PROJECT_ID=self.project.project.id, OS_PASSWORD=self.project.password) - conf_utils.create_rally_deployment(environ=environ) - conf_utils.create_verifier() - self.verifier_id = conf_utils.get_verifier_id() + self.deployment_id = conf_utils.create_rally_deployment( + environ=environ) + if not self.deployment_id: + raise Exception("Deployment create failed") + self.verifier_id = conf_utils.create_verifier() + if not self.verifier_id: + raise Exception("Verifier create failed") self.verifier_repo_dir = conf_utils.get_verifier_repo_dir( self.verifier_id) - self.deployment_id = conf_utils.get_verifier_deployment_id() self.deployment_dir = conf_utils.get_verifier_deployment_dir( self.verifier_id, self.deployment_id) self.verification_id = None @@ -390,6 +393,8 @@ class TempestCommon(singlevm.VmReady2): LOGGER.debug("flavor: %s", self.flavor_alt) self.conf_file = conf_utils.configure_verifier(self.deployment_dir) + if not self.conf_file: + raise Exception("Tempest verifier configuring failed") conf_utils.configure_tempest_update_params( self.conf_file, network_name=self.network.name, image_id=self.image.id, -- cgit 1.2.3-korg