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:
parent
37dd6ec8a3
commit
94472dd7e5
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
|
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)
|
||||||
|
|
||||||
|
|
|
@ -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"],
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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"],
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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"],
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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"],
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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"],
|
||||||
|
|
Loading…
Reference in a new issue