From bcc5bffd8ed5db7457a80cf5b01646eafb6bfa11 Mon Sep 17 00:00:00 2001 From: Ondra Machacek Date: Wed, 7 Jun 2017 00:25:10 +0200 Subject: [PATCH] cloud: ovirt: Fix searching of network in datacenter (#25248) --- lib/ansible/modules/cloud/ovirt/ovirt_networks.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_networks.py b/lib/ansible/modules/cloud/ovirt/ovirt_networks.py index a3df8c5d01f..ffb2bc84dad 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_networks.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_networks.py @@ -229,14 +229,12 @@ def main(): service=networks_service, ) state = module.params['state'] - network = networks_module.search_entity( - search_params={ - 'name': module.params['name'], - 'datacenter': module.params['data_center'], - }, - ) + search_params = { + 'name': module.params['name'], + 'datacenter': module.params['data_center'], + } if state == 'present': - ret = networks_module.create(entity=network) + ret = networks_module.create(search_params=search_params) # Update clusters networks: if module.params.get('clusters') is not None: @@ -258,7 +256,7 @@ def main(): ret = cluster_networks_module.remove() elif state == 'absent': - ret = networks_module.remove(entity=network) + ret = networks_module.remove(search_params=search_params) module.exit_json(**ret) except Exception as e: