From d4f57cb256542e42cfafd586b8c9ef025e6ef005 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Thu, 13 Oct 2016 15:29:35 +0200 Subject: Remove exits in OpenStack client utils MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It prevents openstack_utils from exiting when the mandatory env vars are unset. Every testcase is now in charge of handling the exception MissingEnvVar. JIRA: FUNCTEST-438 Change-Id: I0e321b544a470c1f2f2fa62b3e061fe5f938e112 Signed-off-by: Cédric Ollivier --- testcases/Controllers/ODL/OpenDaylightTesting.py | 27 +++++++++++++----------- 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'testcases/Controllers') diff --git a/testcases/Controllers/ODL/OpenDaylightTesting.py b/testcases/Controllers/ODL/OpenDaylightTesting.py index 0ee37b64..591faac5 100755 --- a/testcases/Controllers/ODL/OpenDaylightTesting.py +++ b/testcases/Controllers/ODL/OpenDaylightTesting.py @@ -143,19 +143,19 @@ class ODLTestCases(TestCasesBase.TestCasesBase): return self.EX_RUN_ERROR def run(self): - kclient = op_utils.get_keystone_client() - keystone_url = kclient.service_catalog.url_for( - service_type='identity', endpoint_type='publicURL') - neutron_url = kclient.service_catalog.url_for( - service_type='network', endpoint_type='publicURL') - kwargs = {'keystoneip': urlparse.urlparse(keystone_url).hostname} - kwargs['neutronip'] = urlparse.urlparse(neutron_url).hostname - kwargs['odlip'] = kwargs['neutronip'] - kwargs['odlwebport'] = '8080' - kwargs['odlrestconfport'] = '8181' - kwargs['odlusername'] = 'admin' - kwargs['odlpassword'] = 'admin' try: + kclient = op_utils.get_keystone_client() + keystone_url = kclient.service_catalog.url_for( + service_type='identity', endpoint_type='publicURL') + neutron_url = kclient.service_catalog.url_for( + service_type='network', endpoint_type='publicURL') + kwargs = {'keystoneip': urlparse.urlparse(keystone_url).hostname} + kwargs['neutronip'] = urlparse.urlparse(neutron_url).hostname + kwargs['odlip'] = kwargs['neutronip'] + kwargs['odlwebport'] = '8080' + kwargs['odlrestconfport'] = '8181' + kwargs['odlusername'] = 'admin' + kwargs['odlpassword'] = 'admin' installer_type = os.environ['INSTALLER_TYPE'] kwargs['osusername'] = os.environ['OS_USERNAME'] kwargs['ostenantname'] = os.environ['OS_TENANT_NAME'] @@ -176,6 +176,9 @@ class ODLTestCases(TestCasesBase.TestCasesBase): "Please check env var: " "%s" % str(e)) return self.EX_RUN_ERROR + except Exception: + self.logger.exception("Cannot run ODL testcases.") + return self.EX_RUN_ERROR return self.main(**kwargs) -- cgit 1.2.3-korg