Skip to content

Commit

Permalink
fixed issue 67
Browse files Browse the repository at this point in the history
  • Loading branch information
VenkateshRavula committed Jun 29, 2020
1 parent bbf3616 commit 9700a0f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Added code to handle login acknowledgement.
- #23 MISSING_JSON_TYPE error code is thrown when attempting to restore the appliance
- #58 loginMsgAck is not handled in python code
- #60 SPT type for api1600 should be ServerProfileTemplateV8
- #67 raise exception when image streamer ip is not provided while running i3s related resources

# 5.2.0
#### Notes
Expand Down
4 changes: 4 additions & 0 deletions hpOneView/oneview_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
from hpOneView.resources.hypervisors.hypervisor_cluster_profiles import HypervisorClusterProfiles

ONEVIEW_CLIENT_INVALID_PROXY = 'Invalid Proxy format'
ONEVIEW_CLIENT_INVALID_I3S_IP = 'Invalid image streamer ip'


class OneViewClient(object):
Expand Down Expand Up @@ -295,6 +296,9 @@ def create_image_streamer_client(self):
Returns:
ImageStreamerClient:
"""
if not self.__image_streamer_ip:
raise ValueError(ONEVIEW_CLIENT_INVALID_I3S_IP)

image_streamer = ImageStreamerClient(self.__image_streamer_ip,
self.__connection.get_session_id(),
self.__connection._apiVersion,
Expand Down
10 changes: 4 additions & 6 deletions tests/unit/test_oneview_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,10 @@ def test_create_image_streamer_client_without_image_streamer_ip(self, mock_login
client = OneViewClient(config)
client.connection.set_session_id('123')

i3s = client.create_image_streamer_client()

self.assertEqual(i3s.connection.get_session_id(), client.connection.get_session_id())
self.assertEqual(i3s.connection._apiVersion, client.api_version)
self.assertEqual(i3s.connection.get_host(), None)
self.assertEqual(client.connection.get_host(), "172.16.102.59")
try:
client.create_image_streamer_client()
except ValueError as e:
self.assertTrue("image streamer ip" in e.args[0])

@mock.patch.object(connection, 'login')
def test_create_image_streamer_client_with_image_streamer_ip(self, mock_login):
Expand Down

0 comments on commit 9700a0f

Please sign in to comment.