summaryrefslogtreecommitdiffstats
path: root/gitautodeploy/parsers/bitbucket.py
diff options
context:
space:
mode:
authorOliver Poignant <oliver@poignant.se>2016-12-12 18:35:03 +0100
committerOliver Poignant <oliver@poignant.se>2016-12-12 18:35:03 +0100
commit8c406865ce388c1856f8dab495df4aa11f64f9cd (patch)
treed85ca148d33d9fd7e3fa37f564546e687a17c276 /gitautodeploy/parsers/bitbucket.py
parent30b8b34af911c3b3661f57366f0eeb56bfb5e3ed (diff)
downloadGit-Auto-Deploy-8c406865ce388c1856f8dab495df4aa11f64f9cd.zip
Git-Auto-Deploy-8c406865ce388c1856f8dab495df4aa11f64f9cd.tar.gz
Git-Auto-Deploy-8c406865ce388c1856f8dab495df4aa11f64f9cd.tar.bz2
Refactoring and preparations for JSON API
Diffstat (limited to 'gitautodeploy/parsers/bitbucket.py')
-rw-r--r--gitautodeploy/parsers/bitbucket.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/gitautodeploy/parsers/bitbucket.py b/gitautodeploy/parsers/bitbucket.py
index 353435c..80899fd 100644
--- a/gitautodeploy/parsers/bitbucket.py
+++ b/gitautodeploy/parsers/bitbucket.py
@@ -2,22 +2,18 @@ from common import WebhookRequestParser
class BitBucketRequestParser(WebhookRequestParser):
- def get_repo_params_from_request(self, request_headers, request_body):
+ def get_repo_configs(self, request_headers, request_body, action):
import json
- import logging
- logger = logging.getLogger()
data = json.loads(request_body)
repo_urls = []
- ref = ""
- action = ""
- logger.debug("Received event from BitBucket")
+ action.log_debug("Received event from BitBucket")
if 'repository' not in data:
- logger.error("Unable to recognize data format")
- return [], ref or "master", action
+ action.log_error("Unable to recognize data format")
+ return []
# One repository may posses multiple URLs for different protocols
for k in ['url', 'git_url', 'clone_url', 'ssh_url']:
@@ -32,6 +28,6 @@ class BitBucketRequestParser(WebhookRequestParser):
repo_urls.append('https://bitbucket.org/%s.git' % (data['repository']['full_name']))
# Get a list of configured repositories that matches the incoming web hook reqeust
- repo_configs = self.get_matching_repo_configs(repo_urls)
+ repo_configs = self.get_matching_repo_configs(repo_urls, action)
- return repo_configs, ref or "master", action, repo_urls \ No newline at end of file
+ return repo_configs \ No newline at end of file