diff options
author | Oliver Poignant <oliver@poignant.se> | 2015-08-23 14:30:36 +0200 |
---|---|---|
committer | Oliver Poignant <oliver@poignant.se> | 2015-08-23 14:30:36 +0200 |
commit | baa10bc6d704e41aba54bf4b81323b71428e5540 (patch) | |
tree | cfad8ad8a0dcef41bbde4c993327c888cc1fbc94 /GitAutoDeploy.py | |
parent | de3eaccf140afeb2cf015accfb4e9f00f490b220 (diff) | |
download | Git-Auto-Deploy-baa10bc6d704e41aba54bf4b81323b71428e5540.zip Git-Auto-Deploy-baa10bc6d704e41aba54bf4b81323b71428e5540.tar.gz Git-Auto-Deploy-baa10bc6d704e41aba54bf4b81323b71428e5540.tar.bz2 |
Added legacy detection code for older GitLab versions
Diffstat (limited to 'GitAutoDeploy.py')
-rwxr-xr-x | GitAutoDeploy.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/GitAutoDeploy.py b/GitAutoDeploy.py index cdb1879..8b59041 100755 --- a/GitAutoDeploy.py +++ b/GitAutoDeploy.py @@ -129,6 +129,7 @@ class WebhookRequestHandler(BaseHTTPRequestHandler): to collect and compare them all.""" import json + content_type = self.headers.getheader('content-type') length = int(self.headers.getheader('content-length')) body = self.rfile.read(length) @@ -181,6 +182,16 @@ class WebhookRequestHandler(BaseHTTPRequestHandler): # needed since the configured repositories might be configured using a different username. repo_urls.append('https://bitbucket.org/%s.git' % (data['repository']['full_name'])) + # If payload is missing, and GitLab wasn't identified through HTTP header, we assume older GitLab syntax. + elif content_type == "application/json" and 'payload' not in data: + + print "Received event from GitLab (old syntax)" + + # One repository may posses multiple URLs for different protocols + for k in ['url', 'git_http_url', 'git_ssh_url']: + if k in data['repository']: + repo_urls.append(data['repository'][k]) + else: print "ERROR - Unable to recognize request origin. Don't know how to handle the request. Outdated GitLab?" |