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_flavor.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_flavor.py')
-rw-r--r-- | snaps/openstack/create_flavor.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/snaps/openstack/create_flavor.py b/snaps/openstack/create_flavor.py index 30271c1..2d78be4 100644 --- a/snaps/openstack/create_flavor.py +++ b/snaps/openstack/create_flavor.py @@ -41,7 +41,7 @@ class OpenStackFlavor: self.__os_creds = os_creds self.flavor_settings = flavor_settings self.__flavor = None - self.__nova = nova_utils.nova_client(self.__os_creds) + self.__nova = None def create(self, cleanup=False): """ @@ -49,6 +49,7 @@ class OpenStackFlavor: :param cleanup: Denotes whether or not this is being called for cleanup or not :return: The OpenStack flavor object """ + self.__nova = nova_utils.nova_client(self.__os_creds) self.__flavor = nova_utils.get_flavor_by_name(self.__nova, self.flavor_settings.name) if self.__flavor: logger.info('Found flavor with name - ' + self.flavor_settings.name) |