Replace .iteritems() with six.iteritems()

Replace .iteritems() with six.iteritems() everywhere except in
module_utils (because there's no 'six' on the remote host).  And except
in lib/ansible/galaxy/data/metadata_template.j2, because I'm not sure
six is available there.
This commit is contained in:
Marius Gedminas 2015-09-03 09:23:27 +03:00
commit 823677b490
28 changed files with 81 additions and 41 deletions

View file

@ -51,7 +51,7 @@ def hash_params(params):
return params
else:
s = set()
for k,v in params.iteritems():
for k,v in iteritems(params):
if isinstance(v, dict):
s.update((k, hash_params(v)))
elif isinstance(v, list):
@ -105,7 +105,7 @@ class Role(Base, Become, Conditional, Taggable):
params['tags'] = role_include.tags
hashed_params = hash_params(params)
if role_include.role in play.ROLE_CACHE:
for (entry, role_obj) in play.ROLE_CACHE[role_include.role].iteritems():
for (entry, role_obj) in iteritems(play.ROLE_CACHE[role_include.role]):
if hashed_params == entry:
if parent_role:
role_obj.add_parent(parent_role)

View file

@ -181,7 +181,7 @@ class RoleDefinition(Base, Become, Conditional, Taggable):
for (key, value) in iteritems(ds):
# use the list of FieldAttribute values to determine what is and is not
# an extra parameter for this role (or sub-class of this role)
if key not in [attr_name for (attr_name, attr_value) in self._get_base_attributes().iteritems()]:
if key not in [attr_name for (attr_name, attr_value) in iteritems(self._get_base_attributes())]:
# this key does not match a field attribute, so it must be a role param
role_params[key] = value
else: