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.
pull/54525/head
Chris St. Pierre 5 years ago committed by ansibot
parent f242f3475e
commit 0943e2a0df

@ -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)))

Loading…
Cancel
Save