mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 06:10:22 -07:00
Removed dict.iteritems() in several other files.
This is for py3 compatibility #18506
This commit is contained in:
parent
7c71c678fa
commit
59227d8c31
13 changed files with 31 additions and 31 deletions
|
@ -240,12 +240,12 @@ class AzureRMModuleBase(object):
|
|||
new_tags = copy.copy(tags) if isinstance(tags, dict) else dict()
|
||||
changed = False
|
||||
if isinstance(self.module.params.get('tags'), dict):
|
||||
for key, value in self.module.params['tags'].iteritems():
|
||||
for key, value in self.module.params['tags'].items():
|
||||
if not new_tags.get(key) or new_tags[key] != value:
|
||||
changed = True
|
||||
new_tags[key] = value
|
||||
if isinstance(tags, dict):
|
||||
for key, value in tags.iteritems():
|
||||
for key, value in tags.items():
|
||||
if not self.module.params['tags'].get(key):
|
||||
new_tags.pop(key)
|
||||
changed = True
|
||||
|
@ -318,7 +318,7 @@ class AzureRMModuleBase(object):
|
|||
|
||||
def _get_env_credentials(self):
|
||||
env_credentials = dict()
|
||||
for attribute, env_variable in AZURE_CREDENTIAL_ENV_MAPPING.iteritems():
|
||||
for attribute, env_variable in AZURE_CREDENTIAL_ENV_MAPPING.items():
|
||||
env_credentials[attribute] = os.environ.get(env_variable, None)
|
||||
|
||||
if env_credentials['profile']:
|
||||
|
@ -337,7 +337,7 @@ class AzureRMModuleBase(object):
|
|||
self.log('Getting credentials')
|
||||
|
||||
arg_credentials = dict()
|
||||
for attribute, env_variable in AZURE_CREDENTIAL_ENV_MAPPING.iteritems():
|
||||
for attribute, env_variable in AZURE_CREDENTIAL_ENV_MAPPING.items():
|
||||
arg_credentials[attribute] = params.get(attribute, None)
|
||||
|
||||
# try module params
|
||||
|
|
|
@ -651,7 +651,7 @@ def format_attributes(attributes):
|
|||
|
||||
def get_flags_from_attributes(attributes):
|
||||
flags = []
|
||||
for key,attr in FILE_ATTRIBUTES.iteritems():
|
||||
for key,attr in FILE_ATTRIBUTES.items():
|
||||
if attr in attributes:
|
||||
flags.append(key)
|
||||
return ''.join(flags)
|
||||
|
|
|
@ -158,7 +158,7 @@ class AnsibleCloudStack(object):
|
|||
|
||||
def has_changed(self, want_dict, current_dict, only_keys=None):
|
||||
result = False
|
||||
for key, value in want_dict.iteritems():
|
||||
for key, value in want_dict.items():
|
||||
|
||||
# Optionally limit by a list of keys
|
||||
if only_keys and key not in only_keys:
|
||||
|
@ -581,12 +581,12 @@ class AnsibleCloudStack(object):
|
|||
if resource:
|
||||
returns = self.common_returns.copy()
|
||||
returns.update(self.returns)
|
||||
for search_key, return_key in returns.iteritems():
|
||||
for search_key, return_key in returns.items():
|
||||
if search_key in resource:
|
||||
self.result[return_key] = resource[search_key]
|
||||
|
||||
# Bad bad API does not always return int when it should.
|
||||
for search_key, return_key in self.returns_to_int.iteritems():
|
||||
for search_key, return_key in self.returns_to_int.items():
|
||||
if search_key in resource:
|
||||
self.result[return_key] = int(resource[search_key])
|
||||
|
||||
|
|
|
@ -343,7 +343,7 @@ def camel_dict_to_snake_dict(camel_dict):
|
|||
|
||||
|
||||
snake_dict = {}
|
||||
for k, v in camel_dict.iteritems():
|
||||
for k, v in camel_dict.items():
|
||||
if isinstance(v, dict):
|
||||
snake_dict[camel_to_snake(k)] = camel_dict_to_snake_dict(v)
|
||||
elif isinstance(v, list):
|
||||
|
@ -378,7 +378,7 @@ def ansible_dict_to_boto3_filter_list(filters_dict):
|
|||
"""
|
||||
|
||||
filters_list = []
|
||||
for k,v in filters_dict.iteritems():
|
||||
for k,v in filters_dict.items():
|
||||
filter_dict = {'Name': k}
|
||||
if isinstance(v, string_types):
|
||||
filter_dict['Values'] = [v]
|
||||
|
@ -443,7 +443,7 @@ def ansible_dict_to_boto3_tag_list(tags_dict):
|
|||
"""
|
||||
|
||||
tags_list = []
|
||||
for k,v in tags_dict.iteritems():
|
||||
for k,v in tags_dict.items():
|
||||
tags_list.append({'Key': k, 'Value': v})
|
||||
|
||||
return tags_list
|
||||
|
|
|
@ -143,7 +143,7 @@ class ExoDns(object):
|
|||
|
||||
def has_changed(self, want_dict, current_dict, only_keys=None):
|
||||
changed = False
|
||||
for key, value in want_dict.iteritems():
|
||||
for key, value in want_dict.items():
|
||||
# Optionally limit by a list of keys
|
||||
if only_keys and key not in only_keys:
|
||||
continue
|
||||
|
|
|
@ -204,7 +204,7 @@ class Play(Base, Taggable, Become):
|
|||
for prompt_data in new_ds:
|
||||
if 'name' not in prompt_data:
|
||||
display.deprecated("Using the 'short form' for vars_prompt has been deprecated")
|
||||
for vname, prompt in prompt_data.iteritems():
|
||||
for vname, prompt in prompt_data.items():
|
||||
vars_prompts.append(dict(
|
||||
name = vname,
|
||||
prompt = prompt,
|
||||
|
|
|
@ -124,7 +124,7 @@ class CallbackModule(CallbackBase):
|
|||
# Sort the tasks by the specified sort
|
||||
if self.sort_order != 'none':
|
||||
results = sorted(
|
||||
self.stats.iteritems(),
|
||||
self.stats.items(),
|
||||
key=lambda x:x[1]['time'],
|
||||
reverse=self.sort_order,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue