summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-02-11 15:45:06 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-02-11 15:45:06 +0900
commit3533b7020a6ee89e8de51aea3ffc0a9b5524c4b7 (patch)
tree525febce5bb2f6efea25e5c11f8a5d29a42ecb2d
parent0af8892a267e9d7f4534c25c1d27feab7ddb9563 (diff)
downloadybd-encode-repo-url.tar.gz
Encode the expanded repo url in the saved target yamlencode-repo-url
This is useful for external tools to operate on the generated yaml
-rw-r--r--ybd/cache.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/ybd/cache.py b/ybd/cache.py
index 12ee8f4..c838269 100644
--- a/ybd/cache.py
+++ b/ybd/cache.py
@@ -54,8 +54,11 @@ def cache_key(dn):
key = 'no-build'
if app.config.get('mode', 'normal') in ['keys-only', 'normal']:
- if dn.get('repo') and not dn.get('tree'):
- dn['tree'], dn['sha'] = get_tree(dn)
+ if dn.get('repo'):
+ if not dn.get('tree'):
+ dn['tree'], dn['sha'] = get_tree(dn)
+ if not dn.get('repourl'):
+ dn['repourl'] = get_repo_url(dn.get('repo'))
factors = hash_factors(dn)
factors = json.dumps(factors, sort_keys=True).encode('utf-8')
key = hashlib.sha256(factors).hexdigest()