ovirt_disks: Fix fail condition for LUN disk (#38726)

Fixes: https://github.com/ansible/ansible/issues/38661
This commit is contained in:
Ondra Machacek 2018-04-13 11:54:18 +02:00 committed by ansibot
parent 8f5320435f
commit efa7ebb8a5

View file

@ -529,7 +529,7 @@ class DisksModule(BaseModule):
def _update_check(self, entity):
return (
equal(self._module.params.get('description'), entity.description) and
equal(self.param('quota_id'), getattr(entity.quota, 'id')) and
equal(self.param('quota_id'), getattr(entity.quota, 'id', None)) and
equal(convert_to_bytes(self._module.params.get('size')), entity.provisioned_size) and
equal(self._module.params.get('shareable'), entity.shareable)
)
@ -617,7 +617,7 @@ def main():
ret = disks_module.create(
entity=disk,
result_state=otypes.DiskStatus.OK if lun is None else None,
fail_condition=lambda d: d.status == otypes.DiskStatus.ILLEGAL,
fail_condition=lambda d: d.status == otypes.DiskStatus.ILLEGAL if lun is None else False,
)
is_new_disk = ret['changed']
ret['changed'] = ret['changed'] or disks_module.update_storage_domains(ret['id'])