1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-10 14:05:07 +00:00

xenserver_guest: fix code style caught by codeqa (#11721)

* xenserver_guest: fix code style caught by codeqa

* add changelog frag
This commit is contained in:
Alexei Znamensky 2026-04-03 14:37:48 +13:00 committed by GitHub
parent d956fb8197
commit 08442186e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- xenserver_guest - use ``enumerate()`` instead of manual index variable in ``for`` loop (https://github.com/ansible-collections/community.general/pull/11721).

View file

@ -938,9 +938,7 @@ class XenServerVM(XenServerObject):
)[0]
self.xapi_session.xenapi.VBD.insert(cdrom_vbd_ref, cdrom_vdi_ref)
elif change.get("networks_changed"):
position = 0
for network_change_list in change["networks_changed"]:
for position, network_change_list in enumerate(change["networks_changed"]):
if network_change_list:
vm_vif_params = self.vm_params["VIFs"][position]
network_params = self.module.params["networks"][position]
@ -1113,7 +1111,6 @@ class XenServerVM(XenServerObject):
network_params[network_change],
)
position += 1
elif change.get("networks_new"):
for position, vif_device in change["networks_new"]:
network_params = self.module.params["networks"][position]