mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 13:20:23 -07:00
use dict comprehension in plugins, part 2 (#8822)
* use dict comprehension in plugins * add changelog frag
This commit is contained in:
parent
ecc048bc12
commit
7e978c77b4
21 changed files with 76 additions and 68 deletions
|
@ -558,9 +558,11 @@ def create_payload(module, uuid):
|
|||
|
||||
# Filter out the few options that are not valid VM properties.
|
||||
module_options = ['force', 'state']
|
||||
# @TODO make this a simple {} comprehension as soon as py2 is ditched
|
||||
# @TODO {k: v for k, v in p.items() if k not in module_options}
|
||||
vmdef = dict([(k, v) for k, v in module.params.items() if k not in module_options and v])
|
||||
vmdef = {
|
||||
k: v
|
||||
for k, v in module.params.items()
|
||||
if k not in module_options and v
|
||||
}
|
||||
|
||||
try:
|
||||
vmdef_json = json.dumps(vmdef)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue