cloud: ovirt: Ignore 404 error when getting entity (#20386)

This commit is contained in:
Ondra Machacek 2017-01-18 16:00:23 +01:00 committed by Ryan Brown
parent b519ee9bb3
commit d9d1194c80
3 changed files with 21 additions and 5 deletions

View file

@ -34,6 +34,7 @@ from ansible.module_utils.ovirt import (
check_sdk,
create_connection,
equal,
get_entity,
ovirt_full_argument_spec,
search_by_name,
wait,
@ -285,7 +286,7 @@ class StorageDomainModule(BaseModule):
return
attached_sd_service = attached_sds_service.storage_domain_service(storage_domain.id)
attached_sd = attached_sd_service.get()
attached_sd = get_entity(attached_sd_service)
if attached_sd and attached_sd.status != sdstate.MAINTENANCE:
if not self._module.check_mode:
@ -305,7 +306,7 @@ class StorageDomainModule(BaseModule):
return
attached_sd_service = attached_sds_service.storage_domain_service(storage_domain.id)
attached_sd = attached_sd_service.get()
attached_sd = get_entity(attached_sd_service)
if attached_sd and attached_sd.status == sdstate.MAINTENANCE:
if not self._module.check_mode:
@ -333,7 +334,7 @@ class StorageDomainModule(BaseModule):
# If storage domain isn't attached, attach it:
attached_sd_service = self._service.service(storage_domain.id)
if attached_sd_service.get() is None:
if get_entity(attached_sd_service) is None:
self._service.add(
otypes.StorageDomain(
id=storage_domain.id,