[PR #5994/1877ef15 backport][stable-6] github_webhook: Don't include secret in the config if it's absent (#6088)

github_webhook: Don't include secret in the config if it's absent (#5994)

* github_webhook: Don't include secret in the config if it's absent

* Add changelogs

* Fix indentation

* Apply suggestion to simplify the check

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: dima1206 <–32818228+dima1206@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 1877ef1510)

Co-authored-by: dima1206 <32818228+dima1206@users.noreply.github.com>
pull/6092/head
patchback[bot] 2023-02-25 11:56:05 +01:00 committed by GitHub
parent e9b8692025
commit 139fcdba88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -0,0 +1,2 @@
bugfixes:
- github_webhook - fix always changed state when no secret is provided (https://github.com/ansible-collections/community.general/pull/5994).

View File

@ -161,13 +161,18 @@ from ansible.module_utils.common.text.converters import to_native
def _create_hook_config(module):
return {
hook_config = {
"url": module.params["url"],
"content_type": module.params["content_type"],
"secret": module.params.get("secret"),
"insecure_ssl": "1" if module.params["insecure_ssl"] else "0"
}
secret = module.params.get("secret")
if secret:
hook_config["secret"] = secret
return hook_config
def create_hook(repo, module):
config = _create_hook_config(module)