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

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>
This commit is contained in:
dima1206 2023-02-25 12:03:13 +02:00 committed by GitHub
parent 53f729730b
commit 1877ef1510
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): def _create_hook_config(module):
return { hook_config = {
"url": module.params["url"], "url": module.params["url"],
"content_type": module.params["content_type"], "content_type": module.params["content_type"],
"secret": module.params.get("secret"),
"insecure_ssl": "1" if module.params["insecure_ssl"] else "0" "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): def create_hook(repo, module):
config = _create_hook_config(module) config = _create_hook_config(module)