mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
Removed dict.iteritems() in modules. (#18859)
This is for py3 compatibility, addressed in #18506
This commit is contained in:
committed by
Toshio Kuratomi
parent
4b27d08643
commit
ef391a11ec
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user