mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 13:50:22 -07:00
cloud: ovirt: fix ovirt_nics profile search (#22684)
This commit is contained in:
parent
672e9a2f61
commit
7a3b6ca37c
1 changed files with 12 additions and 1 deletions
|
@ -212,7 +212,18 @@ def main():
|
||||||
dcs_service = connection.system_service().data_centers_service()
|
dcs_service = connection.system_service().data_centers_service()
|
||||||
dc = dcs_service.list(search='Clusters.name=%s' % cluster_name)[0]
|
dc = dcs_service.list(search='Clusters.name=%s' % cluster_name)[0]
|
||||||
networks_service = dcs_service.service(dc.id).networks_service()
|
networks_service = dcs_service.service(dc.id).networks_service()
|
||||||
network = search_by_name(networks_service, module.params['network'])
|
network = next(
|
||||||
|
(n for n in networks_service.list()
|
||||||
|
if n.name == module.params['network']),
|
||||||
|
None
|
||||||
|
)
|
||||||
|
if network is None:
|
||||||
|
raise Exception(
|
||||||
|
"Network '%s' was not found in datacenter '%s'." % (
|
||||||
|
module.params['network'],
|
||||||
|
dc.name
|
||||||
|
)
|
||||||
|
)
|
||||||
for vnic in connection.system_service().vnic_profiles_service().list():
|
for vnic in connection.system_service().vnic_profiles_service().list():
|
||||||
if vnic.name == profile and vnic.network.id == network.id:
|
if vnic.name == profile and vnic.network.id == network.id:
|
||||||
vmnics_module.vnic_id = vnic.id
|
vmnics_module.vnic_id = vnic.id
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue