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

@ -484,7 +484,7 @@ def cloudservers(module, state=None, name=None, flavor=None, image=None,
if not boot_from_volume and not boot_volume and not image:
module.fail_json(msg='image is required for the "rax" module')
for arg, value in dict(name=name, flavor=flavor).iteritems():
for arg, value in dict(name=name, flavor=flavor).items():
if not value:
module.fail_json(msg='%s is required for the "rax" module' %
arg)

View file

@ -129,7 +129,7 @@ def cloud_block_storage_attachments(module, state, volume, server, device,
volume.get()
for key, value in vars(volume).iteritems():
for key, value in vars(volume).items():
if (isinstance(value, NON_CALLABLES) and
not key.startswith('_')):
instance[key] = value

View file

@ -114,7 +114,7 @@ def save_instance(module, name, flavor, volume, cdb_type, cdb_version, wait,
for arg, value in dict(name=name, flavor=flavor,
volume=volume, type=cdb_type, version=cdb_version
).iteritems():
).items():
if not value:
module.fail_json(msg='%s is required for the "rax_cdb"'
' module' % arg)

View file

@ -93,7 +93,7 @@ def find_user(instance, name):
def save_user(module, cdb_id, name, password, databases, host):
for arg, value in dict(cdb_id=cdb_id, name=name).iteritems():
for arg, value in dict(cdb_id=cdb_id, name=name).items():
if not value:
module.fail_json(msg='%s is required for the "rax_cdb_user" '
'module' % arg)
@ -148,7 +148,7 @@ def save_user(module, cdb_id, name, password, databases, host):
def delete_user(module, cdb_id, name):
for arg, value in dict(cdb_id=cdb_id, name=name).iteritems():
for arg, value in dict(cdb_id=cdb_id, name=name).items():
if not value:
module.fail_json(msg='%s is required for the "rax_cdb_user"'
' module' % arg)

View file

@ -200,7 +200,7 @@ def cloud_load_balancer(module, state, name, meta, algorithm, port, protocol,
'protocol': protocol,
'timeout': timeout
}
for att, value in atts.iteritems():
for att, value in atts.items():
current = getattr(balancer, att)
if current != value:
changed = True

View file

@ -143,7 +143,7 @@ def cloud_load_balancer_ssl(module, loadbalancer, state, enabled, private_key,
needs_change = False
if existing_ssl:
for ssl_attr, value in ssl_attrs.iteritems():
for ssl_attr, value in ssl_attrs.items():
if ssl_attr == 'privatekey':
# The private key is not included in get_ssl_termination's
# output (as it shouldn't be). Also, if you're changing the

View file

@ -191,7 +191,7 @@ def cloud_check(module, state, entity_id, label, check_type,
# Only force a recreation of the check if one of the *specified*
# keys is missing or has a different value.
if details:
for (key, value) in details.iteritems():
for (key, value) in details.items():
if key not in check.details:
should_delete = should_create = True
elif value != check.details[key]: