github_webhook: Fix create of new hook with existing hooks (#54458)

When creating a new webhook with existing hooks already in place, the
module would erroneously select one of the existing hooks to update
instead of creating the hook anew. This fixes that bug.
This commit is contained in:
Chris St. Pierre 2019-03-27 09:05:34 -05:00 committed by ansibot
parent f242f3475e
commit 0943e2a0df

View file

@ -255,6 +255,8 @@ def main():
for hook in repo.get_hooks():
if hook.config.get("url") == module.params["url"]:
break
else:
hook = None
except github.GithubException as err:
module.fail_json(msg="Unable to get hooks from repository %s: %s" % (
module.params["repository"], to_native(err)))