ovirt_hosts: print error when host for iscsi login not found (#30928)

This commit is contained in:
Ondra Machacek 2017-10-04 10:33:45 +02:00 committed by ansibot
parent 3978baf32f
commit 47e9353a31

View file

@ -241,6 +241,7 @@ from ansible.module_utils.ovirt import (
create_connection,
equal,
get_entity,
get_id_by_name,
ovirt_full_argument_spec,
search_by_name,
wait,
@ -262,8 +263,8 @@ class StorageDomainModule(BaseModule):
def _login(self, storage_type, storage):
if storage_type == 'iscsi':
hosts_service = self._connection.system_service().hosts_service()
host = search_by_name(hosts_service, self._module.params['host'])
hosts_service.host_service(host.id).iscsi_login(
host_id = get_id_by_name(hosts_service, self._module.params['host'])
hosts_service.host_service(host_id).iscsi_login(
iscsi=otypes.IscsiDetails(
username=storage.get('username'),
password=storage.get('password'),