mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[PR #8858/94472dd7 backport][stable-9] use dict comprehension in plugins, part 4 (#8865)
use dict comprehension in plugins, part 4 (#8858)
* use dict comprehension in plugins, part 4
* add changelog frag
(cherry picked from commit 94472dd7e5
)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
7db1613730
commit
cb939cbb75
11 changed files with 26 additions and 30 deletions
11
changelogs/fragments/8858-dict-comprehension.yml
Normal file
11
changelogs/fragments/8858-dict-comprehension.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
minor_changes:
|
||||
- scaleway_container - replace Python 2.6 construct with dict comprehensions (https://github.com/ansible-collections/community.general/pull/8858).
|
||||
- scaleway_container_info - replace Python 2.6 construct with dict comprehensions (https://github.com/ansible-collections/community.general/pull/8858).
|
||||
- scaleway_container_namespace - replace Python 2.6 construct with dict comprehensions (https://github.com/ansible-collections/community.general/pull/8858).
|
||||
- scaleway_container_namespace_info - replace Python 2.6 construct with dict comprehensions (https://github.com/ansible-collections/community.general/pull/8858).
|
||||
- scaleway_container_registry - replace Python 2.6 construct with dict comprehensions (https://github.com/ansible-collections/community.general/pull/8858).
|
||||
- scaleway_container_registry_info - replace Python 2.6 construct with dict comprehensions (https://github.com/ansible-collections/community.general/pull/8858).
|
||||
- scaleway_function - replace Python 2.6 construct with dict comprehensions (https://github.com/ansible-collections/community.general/pull/8858).
|
||||
- scaleway_function_info - replace Python 2.6 construct with dict comprehensions (https://github.com/ansible-collections/community.general/pull/8858).
|
||||
- scaleway_function_namespace - replace Python 2.6 construct with dict comprehensions (https://github.com/ansible-collections/community.general/pull/8858).
|
||||
- scaleway_function_namespace_info - replace Python 2.6 construct with dict comprehensions (https://github.com/ansible-collections/community.general/pull/8858).
|
|
@ -260,8 +260,7 @@ def absent_strategy(api, wished_cn):
|
|||
changed = False
|
||||
|
||||
cn_list = api.fetch_all_resources("containers")
|
||||
cn_lookup = dict((cn["name"], cn)
|
||||
for cn in cn_list)
|
||||
cn_lookup = {cn["name"]: cn for cn in cn_list}
|
||||
|
||||
if wished_cn["name"] not in cn_lookup:
|
||||
return changed, {}
|
||||
|
@ -285,8 +284,7 @@ def present_strategy(api, wished_cn):
|
|||
changed = False
|
||||
|
||||
cn_list = api.fetch_all_resources("containers")
|
||||
cn_lookup = dict((cn["name"], cn)
|
||||
for cn in cn_list)
|
||||
cn_lookup = {cn["name"]: cn for cn in cn_list}
|
||||
|
||||
payload_cn = payload_from_wished_cn(wished_cn)
|
||||
|
||||
|
|
|
@ -97,8 +97,7 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
|
||||
def info_strategy(api, wished_cn):
|
||||
cn_list = api.fetch_all_resources("containers")
|
||||
cn_lookup = dict((fn["name"], fn)
|
||||
for fn in cn_list)
|
||||
cn_lookup = {cn["name"]: cn for cn in cn_list}
|
||||
|
||||
if wished_cn["name"] not in cn_lookup:
|
||||
msg = "Error during container lookup: Unable to find container named '%s' in namespace '%s'" % (wished_cn["name"],
|
||||
|
|
|
@ -167,8 +167,7 @@ def absent_strategy(api, wished_cn):
|
|||
changed = False
|
||||
|
||||
cn_list = api.fetch_all_resources("namespaces")
|
||||
cn_lookup = dict((cn["name"], cn)
|
||||
for cn in cn_list)
|
||||
cn_lookup = {cn["name"]: cn for cn in cn_list}
|
||||
|
||||
if wished_cn["name"] not in cn_lookup:
|
||||
return changed, {}
|
||||
|
@ -192,8 +191,7 @@ def present_strategy(api, wished_cn):
|
|||
changed = False
|
||||
|
||||
cn_list = api.fetch_all_resources("namespaces")
|
||||
cn_lookup = dict((cn["name"], cn)
|
||||
for cn in cn_list)
|
||||
cn_lookup = {cn["name"]: cn for cn in cn_list}
|
||||
|
||||
payload_cn = payload_from_wished_cn(wished_cn)
|
||||
|
||||
|
|
|
@ -88,8 +88,7 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
|
||||
def info_strategy(api, wished_cn):
|
||||
cn_list = api.fetch_all_resources("namespaces")
|
||||
cn_lookup = dict((fn["name"], fn)
|
||||
for fn in cn_list)
|
||||
cn_lookup = {cn["name"]: cn for cn in cn_list}
|
||||
|
||||
if wished_cn["name"] not in cn_lookup:
|
||||
msg = "Error during container namespace lookup: Unable to find container namespace named '%s' in project '%s'" % (wished_cn["name"],
|
||||
|
|
|
@ -150,8 +150,7 @@ def absent_strategy(api, wished_cr):
|
|||
changed = False
|
||||
|
||||
cr_list = api.fetch_all_resources("namespaces")
|
||||
cr_lookup = dict((cr["name"], cr)
|
||||
for cr in cr_list)
|
||||
cr_lookup = {cr["name"]: cr for cr in cr_list}
|
||||
|
||||
if wished_cr["name"] not in cr_lookup:
|
||||
return changed, {}
|
||||
|
@ -175,8 +174,7 @@ def present_strategy(api, wished_cr):
|
|||
changed = False
|
||||
|
||||
cr_list = api.fetch_all_resources("namespaces")
|
||||
cr_lookup = dict((cr["name"], cr)
|
||||
for cr in cr_list)
|
||||
cr_lookup = {cr["name"]: cr for cr in cr_list}
|
||||
|
||||
payload_cr = payload_from_wished_cr(wished_cr)
|
||||
|
||||
|
|
|
@ -87,8 +87,7 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
|
||||
def info_strategy(api, wished_cn):
|
||||
cn_list = api.fetch_all_resources("namespaces")
|
||||
cn_lookup = dict((fn["name"], fn)
|
||||
for fn in cn_list)
|
||||
cn_lookup = {cn["name"]: cn for cn in cn_list}
|
||||
|
||||
if wished_cn["name"] not in cn_lookup:
|
||||
msg = "Error during container registries lookup: Unable to find container registry named '%s' in project '%s'" % (wished_cn["name"],
|
||||
|
|
|
@ -245,8 +245,7 @@ def absent_strategy(api, wished_fn):
|
|||
changed = False
|
||||
|
||||
fn_list = api.fetch_all_resources("functions")
|
||||
fn_lookup = dict((fn["name"], fn)
|
||||
for fn in fn_list)
|
||||
fn_lookup = {fn["name"]: fn for fn in fn_list}
|
||||
|
||||
if wished_fn["name"] not in fn_lookup:
|
||||
return changed, {}
|
||||
|
@ -270,8 +269,7 @@ def present_strategy(api, wished_fn):
|
|||
changed = False
|
||||
|
||||
fn_list = api.fetch_all_resources("functions")
|
||||
fn_lookup = dict((fn["name"], fn)
|
||||
for fn in fn_list)
|
||||
fn_lookup = {fn["name"]: fn for fn in fn_list}
|
||||
|
||||
payload_fn = payload_from_wished_fn(wished_fn)
|
||||
|
||||
|
|
|
@ -96,8 +96,7 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
|
||||
def info_strategy(api, wished_fn):
|
||||
fn_list = api.fetch_all_resources("functions")
|
||||
fn_lookup = dict((fn["name"], fn)
|
||||
for fn in fn_list)
|
||||
fn_lookup = {fn["name"]: fn for fn in fn_list}
|
||||
|
||||
if wished_fn["name"] not in fn_lookup:
|
||||
msg = "Error during function lookup: Unable to find function named '%s' in namespace '%s'" % (wished_fn["name"],
|
||||
|
|
|
@ -168,8 +168,7 @@ def absent_strategy(api, wished_fn):
|
|||
changed = False
|
||||
|
||||
fn_list = api.fetch_all_resources("namespaces")
|
||||
fn_lookup = dict((fn["name"], fn)
|
||||
for fn in fn_list)
|
||||
fn_lookup = {fn["name"]: fn for fn in fn_list}
|
||||
|
||||
if wished_fn["name"] not in fn_lookup:
|
||||
return changed, {}
|
||||
|
@ -193,8 +192,7 @@ def present_strategy(api, wished_fn):
|
|||
changed = False
|
||||
|
||||
fn_list = api.fetch_all_resources("namespaces")
|
||||
fn_lookup = dict((fn["name"], fn)
|
||||
for fn in fn_list)
|
||||
fn_lookup = {fn["name"]: fn for fn in fn_list}
|
||||
|
||||
payload_fn = payload_from_wished_fn(wished_fn)
|
||||
|
||||
|
|
|
@ -88,8 +88,7 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
|
||||
def info_strategy(api, wished_fn):
|
||||
fn_list = api.fetch_all_resources("namespaces")
|
||||
fn_lookup = dict((fn["name"], fn)
|
||||
for fn in fn_list)
|
||||
fn_lookup = {fn["name"]: fn for fn in fn_list}
|
||||
|
||||
if wished_fn["name"] not in fn_lookup:
|
||||
msg = "Error during function namespace lookup: Unable to find function namespace named '%s' in project '%s'" % (wished_fn["name"],
|
||||
|
|
Loading…
Reference in a new issue