Skip to content

Commit

Permalink
Return None for DC in case of detached storage domain (ansible#29175)
Browse files Browse the repository at this point in the history
The following patch fixes a regression when trying to remove a detached
storage domain.
As part of the remove process the ovirt_storage_domains module first
tries to move the domain to maintenance and detach it.
In case of removing a detached storage domain with no DC attached to it
The maintenace process will fail with 404 (not exists) exception when
trying to fetch the DC using empty Guid.
The fix proposes a solution to return None value in case of a detached
storage domain.
  • Loading branch information
maorlipchuk authored and ansibot committed Oct 4, 2017
1 parent 5e3177e commit 65749bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,9 @@ def _attached_sds_service(self):
# Serach the data_center name, if it does not exists, try to search by guid.
dc = search_by_name(dcs_service, self._module.params['data_center'])
if dc is None:
dc = dcs_service.service(self._module.params['data_center']).get()
dc = get_entity(dcs_service.service(self._module.params['data_center']))
if dc is None:
return
return None

dc_service = dcs_service.data_center_service(dc.id)
return dc_service.storage_domains_service()
Expand Down

0 comments on commit 65749bd

Please sign in to comment.