diff options
author | Oliver Poignant <oliver@poignant.se> | 2016-05-09 23:04:15 +0200 |
---|---|---|
committer | Oliver Poignant <oliver@poignant.se> | 2016-05-09 23:04:15 +0200 |
commit | b75e96d7dd8d16c60075b6fefbfb77824ccf2777 (patch) | |
tree | 5df654467fccc40c171e9aac9edbef618e389267 /gitautodeploy | |
parent | 2d5ca333ffa2675996eb043dcb2265c07539a5b3 (diff) | |
download | Git-Auto-Deploy-b75e96d7dd8d16c60075b6fefbfb77824ccf2777.zip Git-Auto-Deploy-b75e96d7dd8d16c60075b6fefbfb77824ccf2777.tar.gz Git-Auto-Deploy-b75e96d7dd8d16c60075b6fefbfb77824ccf2777.tar.bz2 |
Support embedded credentials in repository URLs
Diffstat (limited to 'gitautodeploy')
-rw-r--r-- | gitautodeploy/cli/config.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/gitautodeploy/cli/config.py b/gitautodeploy/cli/config.py index d4d98fb..8109b34 100644 --- a/gitautodeploy/cli/config.py +++ b/gitautodeploy/cli/config.py @@ -265,14 +265,13 @@ def init_config(config): if 'global_deploy' in config and len(config['global_deploy'][1]) is not 0: repo_config['deploy_commands'].append(config['global_deploy'][1]) - # If a Bitbucket repository is configured using the https:// URL, a username is usually - # specified in the beginning of the URL. To be able to compare configured Bitbucket - # repositories with incoming web hook events, this username needs to be stripped away in a - # copy of the URL. - if 'url' in repo_config and 'bitbucket_username' not in repo_config: - regexp = re.search(r"^(https?://)([^@]+)@(bitbucket\.org/)(.+)$", repo_config['url']) + # If a repository is configured with embedded credentials, we create an alternate URL + # without these credentials that cen be used when comparing the URL with URLs referenced + # in incoming web hook requests. + if 'url' in repo_config: + regexp = re.search(r"^(https?://)([^@]+)@(.+)$", repo_config['url']) if regexp: - repo_config['url_without_usernme'] = regexp.group(1) + regexp.group(3) + regexp.group(4) + repo_config['url_without_usernme'] = regexp.group(1) + regexp.group(3) # Translate any ~ in the path into /home/<user> if 'path' in repo_config: |