From 47e9353a31a563146ab345be563b2d9a5f310f65 Mon Sep 17 00:00:00 2001 From: Ondra Machacek Date: Wed, 4 Oct 2017 10:33:45 +0200 Subject: [PATCH] ovirt_hosts: print error when host for iscsi login not found (#30928) --- lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py b/lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py index 134208e0f8..9b5bc91e18 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py @@ -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'),