mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
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:
@@ -21,6 +21,8 @@ __metaclass__ = type
|
||||
|
||||
import fnmatch
|
||||
|
||||
from six import iteritems
|
||||
|
||||
from ansible import constants as C
|
||||
|
||||
from ansible.errors import *
|
||||
@@ -322,7 +324,7 @@ class PlayIterator:
|
||||
self._host_states[host.name] = s
|
||||
|
||||
def get_failed_hosts(self):
|
||||
return dict((host, True) for (host, state) in self._host_states.iteritems() if state.run_state == self.ITERATING_COMPLETE and state.fail_state != self.FAILED_NONE)
|
||||
return dict((host, True) for (host, state) in iteritems(self._host_states) if state.run_state == self.ITERATING_COMPLETE and state.fail_state != self.FAILED_NONE)
|
||||
|
||||
def get_original_task(self, host, task):
|
||||
'''
|
||||
|
||||
@@ -20,6 +20,8 @@ from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
from six.moves import queue
|
||||
from six import iteritems
|
||||
|
||||
import multiprocessing
|
||||
import os
|
||||
import signal
|
||||
@@ -157,7 +159,7 @@ class ResultProcess(multiprocessing.Process):
|
||||
# if this task is registering facts, do that now
|
||||
item = result_item.get('item', None)
|
||||
if result._task.action in ('set_fact', 'include_vars'):
|
||||
for (key, value) in result_item['ansible_facts'].iteritems():
|
||||
for (key, value) in iteritems(result_item['ansible_facts']):
|
||||
self._send_result(('set_host_var', result._host, result._task, item, key, value))
|
||||
else:
|
||||
self._send_result(('set_host_facts', result._host, result._task, item, result_item['ansible_facts']))
|
||||
|
||||
@@ -25,6 +25,8 @@ import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
from six import iteritems
|
||||
|
||||
from ansible import constants as C
|
||||
from ansible.errors import AnsibleError, AnsibleParserError, AnsibleUndefinedVariable
|
||||
from ansible.playbook.conditional import Conditional
|
||||
@@ -289,7 +291,7 @@ class TaskExecutor:
|
||||
# And filter out any fields which were set to default(omit), and got the omit token value
|
||||
omit_token = variables.get('omit')
|
||||
if omit_token is not None:
|
||||
self._task.args = dict(filter(lambda x: x[1] != omit_token, self._task.args.iteritems()))
|
||||
self._task.args = dict(filter(lambda x: x[1] != omit_token, iteritems(self._task.args)))
|
||||
|
||||
# Read some values from the task, so that we can modify them if need be
|
||||
retries = self._task.retries
|
||||
|
||||
Reference in New Issue
Block a user