1
0
Fork 0
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:
patchback[bot] 2024-09-13 22:58:57 +02:00 committed by GitHub
parent 7db1613730
commit cb939cbb75
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 26 additions and 30 deletions

View 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).

View file

@ -260,8 +260,7 @@ def absent_strategy(api, wished_cn):
changed = False changed = False
cn_list = api.fetch_all_resources("containers") cn_list = api.fetch_all_resources("containers")
cn_lookup = dict((cn["name"], cn) cn_lookup = {cn["name"]: cn for cn in cn_list}
for cn in cn_list)
if wished_cn["name"] not in cn_lookup: if wished_cn["name"] not in cn_lookup:
return changed, {} return changed, {}
@ -285,8 +284,7 @@ def present_strategy(api, wished_cn):
changed = False changed = False
cn_list = api.fetch_all_resources("containers") cn_list = api.fetch_all_resources("containers")
cn_lookup = dict((cn["name"], cn) cn_lookup = {cn["name"]: cn for cn in cn_list}
for cn in cn_list)
payload_cn = payload_from_wished_cn(wished_cn) payload_cn = payload_from_wished_cn(wished_cn)

View file

@ -97,8 +97,7 @@ from ansible.module_utils.basic import AnsibleModule
def info_strategy(api, wished_cn): def info_strategy(api, wished_cn):
cn_list = api.fetch_all_resources("containers") cn_list = api.fetch_all_resources("containers")
cn_lookup = dict((fn["name"], fn) cn_lookup = {cn["name"]: cn for cn in cn_list}
for fn in cn_list)
if wished_cn["name"] not in cn_lookup: 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"], msg = "Error during container lookup: Unable to find container named '%s' in namespace '%s'" % (wished_cn["name"],

View file

@ -167,8 +167,7 @@ def absent_strategy(api, wished_cn):
changed = False changed = False
cn_list = api.fetch_all_resources("namespaces") cn_list = api.fetch_all_resources("namespaces")
cn_lookup = dict((cn["name"], cn) cn_lookup = {cn["name"]: cn for cn in cn_list}
for cn in cn_list)
if wished_cn["name"] not in cn_lookup: if wished_cn["name"] not in cn_lookup:
return changed, {} return changed, {}
@ -192,8 +191,7 @@ def present_strategy(api, wished_cn):
changed = False changed = False
cn_list = api.fetch_all_resources("namespaces") cn_list = api.fetch_all_resources("namespaces")
cn_lookup = dict((cn["name"], cn) cn_lookup = {cn["name"]: cn for cn in cn_list}
for cn in cn_list)
payload_cn = payload_from_wished_cn(wished_cn) payload_cn = payload_from_wished_cn(wished_cn)

View file

@ -88,8 +88,7 @@ from ansible.module_utils.basic import AnsibleModule
def info_strategy(api, wished_cn): def info_strategy(api, wished_cn):
cn_list = api.fetch_all_resources("namespaces") cn_list = api.fetch_all_resources("namespaces")
cn_lookup = dict((fn["name"], fn) cn_lookup = {cn["name"]: cn for cn in cn_list}
for fn in cn_list)
if wished_cn["name"] not in cn_lookup: 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"], msg = "Error during container namespace lookup: Unable to find container namespace named '%s' in project '%s'" % (wished_cn["name"],

View file

@ -150,8 +150,7 @@ def absent_strategy(api, wished_cr):
changed = False changed = False
cr_list = api.fetch_all_resources("namespaces") cr_list = api.fetch_all_resources("namespaces")
cr_lookup = dict((cr["name"], cr) cr_lookup = {cr["name"]: cr for cr in cr_list}
for cr in cr_list)
if wished_cr["name"] not in cr_lookup: if wished_cr["name"] not in cr_lookup:
return changed, {} return changed, {}
@ -175,8 +174,7 @@ def present_strategy(api, wished_cr):
changed = False changed = False
cr_list = api.fetch_all_resources("namespaces") cr_list = api.fetch_all_resources("namespaces")
cr_lookup = dict((cr["name"], cr) cr_lookup = {cr["name"]: cr for cr in cr_list}
for cr in cr_list)
payload_cr = payload_from_wished_cr(wished_cr) payload_cr = payload_from_wished_cr(wished_cr)

View file

@ -87,8 +87,7 @@ from ansible.module_utils.basic import AnsibleModule
def info_strategy(api, wished_cn): def info_strategy(api, wished_cn):
cn_list = api.fetch_all_resources("namespaces") cn_list = api.fetch_all_resources("namespaces")
cn_lookup = dict((fn["name"], fn) cn_lookup = {cn["name"]: cn for cn in cn_list}
for fn in cn_list)
if wished_cn["name"] not in cn_lookup: 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"], msg = "Error during container registries lookup: Unable to find container registry named '%s' in project '%s'" % (wished_cn["name"],

View file

@ -245,8 +245,7 @@ def absent_strategy(api, wished_fn):
changed = False changed = False
fn_list = api.fetch_all_resources("functions") fn_list = api.fetch_all_resources("functions")
fn_lookup = dict((fn["name"], fn) fn_lookup = {fn["name"]: fn for fn in fn_list}
for fn in fn_list)
if wished_fn["name"] not in fn_lookup: if wished_fn["name"] not in fn_lookup:
return changed, {} return changed, {}
@ -270,8 +269,7 @@ def present_strategy(api, wished_fn):
changed = False changed = False
fn_list = api.fetch_all_resources("functions") fn_list = api.fetch_all_resources("functions")
fn_lookup = dict((fn["name"], fn) fn_lookup = {fn["name"]: fn for fn in fn_list}
for fn in fn_list)
payload_fn = payload_from_wished_fn(wished_fn) payload_fn = payload_from_wished_fn(wished_fn)

View file

@ -96,8 +96,7 @@ from ansible.module_utils.basic import AnsibleModule
def info_strategy(api, wished_fn): def info_strategy(api, wished_fn):
fn_list = api.fetch_all_resources("functions") fn_list = api.fetch_all_resources("functions")
fn_lookup = dict((fn["name"], fn) fn_lookup = {fn["name"]: fn for fn in fn_list}
for fn in fn_list)
if wished_fn["name"] not in fn_lookup: 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"], msg = "Error during function lookup: Unable to find function named '%s' in namespace '%s'" % (wished_fn["name"],

View file

@ -168,8 +168,7 @@ def absent_strategy(api, wished_fn):
changed = False changed = False
fn_list = api.fetch_all_resources("namespaces") fn_list = api.fetch_all_resources("namespaces")
fn_lookup = dict((fn["name"], fn) fn_lookup = {fn["name"]: fn for fn in fn_list}
for fn in fn_list)
if wished_fn["name"] not in fn_lookup: if wished_fn["name"] not in fn_lookup:
return changed, {} return changed, {}
@ -193,8 +192,7 @@ def present_strategy(api, wished_fn):
changed = False changed = False
fn_list = api.fetch_all_resources("namespaces") fn_list = api.fetch_all_resources("namespaces")
fn_lookup = dict((fn["name"], fn) fn_lookup = {fn["name"]: fn for fn in fn_list}
for fn in fn_list)
payload_fn = payload_from_wished_fn(wished_fn) payload_fn = payload_from_wished_fn(wished_fn)

View file

@ -88,8 +88,7 @@ from ansible.module_utils.basic import AnsibleModule
def info_strategy(api, wished_fn): def info_strategy(api, wished_fn):
fn_list = api.fetch_all_resources("namespaces") fn_list = api.fetch_all_resources("namespaces")
fn_lookup = dict((fn["name"], fn) fn_lookup = {fn["name"]: fn for fn in fn_list}
for fn in fn_list)
if wished_fn["name"] not in fn_lookup: 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"], msg = "Error during function namespace lookup: Unable to find function namespace named '%s' in project '%s'" % (wished_fn["name"],