mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
ported iterkeys to py3 syntax (#5657)
* ported iterkeys to py3 syntax Addresses ansible/ansible#18507 * Use ansible.module_utils.six.moves iterkeys instead of dict.keys() * Removed 'iterkeys'
This commit is contained in:
parent
c0c26f83a8
commit
48d47a57d5
1 changed files with 4 additions and 3 deletions
|
@ -19,6 +19,7 @@
|
||||||
# TODO:
|
# TODO:
|
||||||
# Ability to set CPU/Memory reservations
|
# Ability to set CPU/Memory reservations
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import json
|
import json
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -983,7 +984,7 @@ def reconfigure_vm(vsphere_client, vm, module, esxi, resource_pool, cluster_name
|
||||||
disk_num = 0
|
disk_num = 0
|
||||||
dev_changes = []
|
dev_changes = []
|
||||||
disks_changed = {}
|
disks_changed = {}
|
||||||
for disk in sorted(vm_disk.iterkeys()):
|
for disk in sorted(vm_disk):
|
||||||
try:
|
try:
|
||||||
disksize = int(vm_disk[disk]['size_gb'])
|
disksize = int(vm_disk[disk]['size_gb'])
|
||||||
# Convert the disk size to kilobytes
|
# Convert the disk size to kilobytes
|
||||||
|
@ -1339,7 +1340,7 @@ def create_vm(vsphere_client, module, esxi, resource_pool, cluster_name, guest,
|
||||||
if vm_disk:
|
if vm_disk:
|
||||||
disk_num = 0
|
disk_num = 0
|
||||||
disk_key = 0
|
disk_key = 0
|
||||||
for disk in sorted(vm_disk.iterkeys()):
|
for disk in sorted(vm_disk):
|
||||||
try:
|
try:
|
||||||
datastore = vm_disk[disk]['datastore']
|
datastore = vm_disk[disk]['datastore']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -1395,7 +1396,7 @@ def create_vm(vsphere_client, module, esxi, resource_pool, cluster_name, guest,
|
||||||
add_floppy(module, vsphere_client, config_target, config, devices,
|
add_floppy(module, vsphere_client, config_target, config, devices,
|
||||||
default_devs, floppy_type, floppy_image_path)
|
default_devs, floppy_type, floppy_image_path)
|
||||||
if vm_nic:
|
if vm_nic:
|
||||||
for nic in sorted(vm_nic.iterkeys()):
|
for nic in sorted(vm_nic):
|
||||||
try:
|
try:
|
||||||
nictype = vm_nic[nic]['type']
|
nictype = vm_nic[nic]['type']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|
Loading…
Add table
Reference in a new issue