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

@ -20,6 +20,8 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from six.moves import queue as Queue
from six import iteritems
import time
from ansible import constants as C
@ -207,7 +209,7 @@ class StrategyBase:
if task_result._task._role is not None and result[0] in ('host_task_ok', 'host_task_failed'):
# lookup the role in the ROLE_CACHE to make sure we're dealing
# with the correct object and mark it as executed
for (entry, role_obj) in iterator._play.ROLE_CACHE[task_result._task._role._role_name].iteritems():
for (entry, role_obj) in iteritems(iterator._play.ROLE_CACHE[task_result._task._role._role_name]):
if role_obj._uuid == task_result._task._role._uuid:
role_obj._had_task_run[host.name] = True
@ -358,7 +360,7 @@ class StrategyBase:
groups[group_name] = []
groups[group_name].append(host)
for group_name, hosts in groups.iteritems():
for group_name, hosts in iteritems(groups):
new_group = self._inventory.get_group(group_name)
if not new_group:
# create the new group and add it to inventory