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

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

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>
This commit is contained in:
patchback[bot] 2023-02-25 11:56:00 +01:00 committed by GitHub
parent 5da6dc7d72
commit c3b1a3a873
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

@ -154,13 +154,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)