mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
use dict comprehension in plugins, part 4 (#8858)
* use dict comprehension in plugins, part 4 * add changelog frag
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user