Removed dict.iteritems() in modules. (#18859)

This is for py3 compatibility, addressed in #18506
This commit is contained in:
Andrea Tartaglia
2016-12-12 23:16:23 +00:00
committed by Toshio Kuratomi
parent 4b27d08643
commit ef391a11ec
99 changed files with 251 additions and 250 deletions

View File

@@ -328,7 +328,7 @@ def node_check(proxmox, node):
def create_instance(module, proxmox, vmid, node, disk, storage, cpus, memory, swap, timeout, **kwargs):
proxmox_node = proxmox.nodes(node)
kwargs = dict((k,v) for k, v in kwargs.iteritems() if v is not None)
kwargs = dict((k,v) for k, v in kwargs.items() if v is not None)
if VZ_TYPE =='lxc':
kwargs['cpulimit']=cpus
kwargs['rootfs']=disk

View File

@@ -689,7 +689,7 @@ def get_vminfo(module, proxmox, node, vmid, **kwargs):
module.fail_json(msg='Getting information for VM with vmid = %s failed with exception: %s' % (vmid, e))
# Sanitize kwargs. Remove not defined args and ensure True and False converted to int.
kwargs = dict((k,v) for k, v in kwargs.iteritems() if v is not None)
kwargs = dict((k,v) for k, v in kwargs.items() if v is not None)
# Convert all dict in kwargs to elements. For hostpci[n], ide[n], net[n], numa[n], parallel[n], sata[n], scsi[n], serial[n], virtio[n]
for k in kwargs.keys():
@@ -698,7 +698,7 @@ def get_vminfo(module, proxmox, node, vmid, **kwargs):
del kwargs[k]
# Split information by type
for k, v in kwargs.iteritems():
for k, v in kwargs.items():
if re.match(r'net[0-9]', k) is not None:
interface = k
k = vm[k]
@@ -723,8 +723,8 @@ def create_vm(module, proxmox, vmid, node, name, memory, cpu, cores, sockets, ti
proxmox_node = proxmox.nodes(node)
# Sanitize kwargs. Remove not defined args and ensure True and False converted to int.
kwargs = dict((k,v) for k, v in kwargs.iteritems() if v is not None)
kwargs.update(dict([k, int(v)] for k, v in kwargs.iteritems() if isinstance(v, bool)))
kwargs = dict((k,v) for k, v in kwargs.items() if v is not None)
kwargs.update(dict([k, int(v)] for k, v in kwargs.items() if isinstance(v, bool)))
# The features work only on PVE 4
if PVE_MAJOR_VERSION < 4:

View File

@@ -129,7 +129,7 @@ def change_keys(recs, key='uuid', filter_func=None):
"""
new_recs = {}
for ref, rec in recs.iteritems():
for ref, rec in recs.items():
if filter_func is not None and not filter_func(rec):
continue