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:
parent
5da6dc7d72
commit
c3b1a3a873
2 changed files with 9 additions and 2 deletions
2
changelogs/fragments/5994-github-webhook-secret.yml
Normal file
2
changelogs/fragments/5994-github-webhook-secret.yml
Normal 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).
|
|
@ -154,13 +154,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)
|
||||||
|
|
Loading…
Reference in a new issue