1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

use dict comprehension in plugins, part 4 (#8858)

* use dict comprehension in plugins, part 4

* add changelog frag
This commit is contained in:
Alexei Znamensky 2024-09-14 08:41:53 +12:00 committed by GitHub
parent 37dd6ec8a3
commit 94472dd7e5
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
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)

View file

@ -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"],

View file

@ -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)

View file

@ -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"],

View file

@ -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)

View file

@ -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"],

View file

@ -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)

View file

@ -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"],

View file

@ -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)

View file

@ -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"],