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

gitlab_hook: use None for non-existent attr in gitlab API response (#4668)

* gitlab_hook: use empty string for non-existent attr in gitlab API response;

* gitlab_hook: use None for non-existent attr in gitlab API response;

* gitlab_hook: use None for non-existent attr in gitlab API response - add changelog fragment;

* gitlab_hook: update changelog fragment for #4668

* Update changelogs/fragments/4668-gitlab_hook-use-None-for-non-existent-attr.yml

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Kirill Petrov 2022-05-17 08:45:10 +03:00 committed by GitHub
parent 97c01174a2
commit da2dfd0706
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- gitlab_hook - avoid errors during idempotency check when an attribute does not exist (https://github.com/ansible-collections/community.general/pull/4668).

View file

@ -257,7 +257,7 @@ class GitLabHook(object):
for arg_key, arg_value in arguments.items():
if arguments[arg_key] is not None:
if getattr(hook, arg_key) != arguments[arg_key]:
if getattr(hook, arg_key, None) != arguments[arg_key]:
setattr(hook, arg_key, arguments[arg_key])
changed = True