From 6fd1af82cd7bf41274c4e1620006004b79628759 Mon Sep 17 00:00:00 2001 From: spisarski Date: Tue, 16 May 2017 13:57:26 -0600 Subject: Ensure creators' constructors cannot raise exceptions. While creating unit tests for vPing that is using SNAPS, exceptions can be raised when retrieving their respective OpenStack clients with incorrect credentials. Moved client retrieval to the create() method which one should expect exceptions to be raised. JIRA: SNAPS-81 Change-Id: Id8e4279f60b97704b25a89c6312dcf2ebdc3f459 Signed-off-by: spisarski --- snaps/openstack/create_router.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'snaps/openstack/create_router.py') diff --git a/snaps/openstack/create_router.py b/snaps/openstack/create_router.py index 5c461cc..0b56424 100644 --- a/snaps/openstack/create_router.py +++ b/snaps/openstack/create_router.py @@ -42,7 +42,7 @@ class OpenStackRouter: raise Exception('router_settings is required') self.router_settings = router_settings - self.__neutron = neutron_utils.neutron_client(os_creds) + self.__neutron = None # Attributes instantiated on create() self.__router = None @@ -58,6 +58,8 @@ class OpenStackRouter: :param cleanup: When true, only perform lookups for OpenStack objects. :return: the router object """ + self.__neutron = neutron_utils.neutron_client(self.__os_creds) + logger.debug('Creating Router with name - ' + self.router_settings.name) existing = False router_inst = neutron_utils.get_router_by_name(self.__neutron, self.router_settings.name) -- cgit 1.2.3-korg