Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resync webhooks from Admin #3933

Merged
merged 1 commit into from Apr 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions readthedocs/oauth/services/bitbucket.py
Expand Up @@ -274,6 +274,12 @@ def update_webhook(self, project, integration):
project,
)
return (True, resp)

# Bitbucket returns 404 when the webhook doesn't exist. In this
# case, we call ``setup_webhook`` to re-configure it from scratch
if resp.status_code == 404:
return self.setup_webhook(project)

# Catch exceptions with request or deserializing JSON
except (KeyError, RequestException, ValueError):
log.exception(
Expand Down
6 changes: 6 additions & 0 deletions readthedocs/oauth/services/github.py
Expand Up @@ -261,6 +261,12 @@ def update_webhook(self, project, integration):
project,
)
return (True, resp)

# GitHub returns 404 when the webhook doesn't exist. In this case,
# we call ``setup_webhook`` to re-configure it from scratch
if resp.status_code == 404:
return self.setup_webhook(project)

# Catch exceptions with request or deserializing JSON
except (RequestException, ValueError):
log.exception(
Expand Down
6 changes: 6 additions & 0 deletions readthedocs/oauth/services/gitlab.py
Expand Up @@ -331,6 +331,12 @@ def update_webhook(self, project, integration):
log.info(
'GitLab webhook update successful for project: %s', project)
return (True, resp)

# GitLab returns 404 when the webhook doesn't exist. In this case,
# we call ``setup_webhook`` to re-configure it from scratch
if resp.status_code == 404:
return self.setup_webhook(project)

# Catch exceptions with request or deserializing JSON
except (RequestException, ValueError):
log.exception(
Expand Down