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'
pull/18777/head
Andrea Tartaglia 8 years ago committed by Matt Clay
parent c0c26f83a8
commit 48d47a57d5

@ -19,6 +19,7 @@
# TODO:
# Ability to set CPU/Memory reservations
try:
import json
except ImportError:
@ -983,7 +984,7 @@ def reconfigure_vm(vsphere_client, vm, module, esxi, resource_pool, cluster_name
disk_num = 0
dev_changes = []
disks_changed = {}
for disk in sorted(vm_disk.iterkeys()):
for disk in sorted(vm_disk):
try:
disksize = int(vm_disk[disk]['size_gb'])
# 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:
disk_num = 0
disk_key = 0
for disk in sorted(vm_disk.iterkeys()):
for disk in sorted(vm_disk):
try:
datastore = vm_disk[disk]['datastore']
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,
default_devs, floppy_type, floppy_image_path)
if vm_nic:
for nic in sorted(vm_nic.iterkeys()):
for nic in sorted(vm_nic):
try:
nictype = vm_nic[nic]['type']
except KeyError:

Loading…
Cancel
Save