Skip to content

Commit

Permalink
ported iterkeys to py3 syntax (ansible#5657)
Browse files Browse the repository at this point in the history
* ported iterkeys to py3 syntax

Addresses ansible#18507

* Use ansible.module_utils.six.moves iterkeys instead of dict.keys()

* Removed 'iterkeys'
  • Loading branch information
Shaps authored and mattclay committed Dec 8, 2016
1 parent c0c26f8 commit 48d47a5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/ansible/modules/cloud/vmware/vsphere_guest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# TODO:
# Ability to set CPU/Memory reservations


try:
import json
except ImportError:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 48d47a5

Please sign in to comment.