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

* 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>
(cherry picked from commit da2dfd0706)

Co-authored-by: Kirill Petrov <crw.inbox@gmail.com>
pull/4684/head
Felix Fontein 2022-05-17 08:35:24 +02:00 committed by GitHub
parent ae94c11a78
commit c23dbb83d0
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