diff options
author | spisarski <s.pisarski@cablelabs.com> | 2017-05-16 13:57:26 -0600 |
---|---|---|
committer | spisarski <s.pisarski@cablelabs.com> | 2017-05-16 13:57:26 -0600 |
commit | 6fd1af82cd7bf41274c4e1620006004b79628759 (patch) | |
tree | e60a9f18c777892f5fe3cb0a8b279cc99b847e20 /snaps/openstack/create_router.py | |
parent | f57080bd2a6412c8fdc50c68111e780f6c36a360 (diff) |
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 <s.pisarski@cablelabs.com>
Diffstat (limited to 'snaps/openstack/create_router.py')
-rw-r--r-- | snaps/openstack/create_router.py | 4 |
1 files changed, 3 insertions, 1 deletions
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) |