mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 04:11:25 -07:00
[PR #8822/7e978c77 backport][stable-9] use dict comprehension in plugins, part 2 (#8832)
use dict comprehension in plugins, part 2 (#8822)
* use dict comprehension in plugins
* add changelog frag
(cherry picked from commit 7e978c77b4
)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
19613ce111
commit
7c3b441246
21 changed files with 76 additions and 68 deletions
|
@ -534,11 +534,7 @@ class GitLabProject(object):
|
|||
@param arguments Attributes of the project
|
||||
'''
|
||||
def get_options_with_value(self, arguments):
|
||||
ret_arguments = dict()
|
||||
for arg_key, arg_value in arguments.items():
|
||||
if arguments[arg_key] is not None:
|
||||
ret_arguments[arg_key] = arg_value
|
||||
|
||||
ret_arguments = {k: v for k, v in arguments.items() if v is not None}
|
||||
return ret_arguments
|
||||
|
||||
'''
|
||||
|
@ -549,8 +545,8 @@ class GitLabProject(object):
|
|||
changed = False
|
||||
|
||||
for arg_key, arg_value in arguments.items():
|
||||
if arguments[arg_key] is not None:
|
||||
if getattr(project, arg_key, None) != arguments[arg_key]:
|
||||
if arg_value is not None:
|
||||
if getattr(project, arg_key, None) != arg_value:
|
||||
if arg_key == 'container_expiration_policy':
|
||||
old_val = getattr(project, arg_key, {})
|
||||
final_val = {key: value for key, value in arg_value.items() if value is not None}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue