cloud: ovirt: Fix searching of network in datacenter (#25248)

This commit is contained in:
Ondra Machacek 2017-06-07 00:25:10 +02:00 committed by René Moser
parent cbe87d0af7
commit bcc5bffd8e

View file

@ -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: