summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Brown <ben.brown@codethink.co.uk>2017-09-26 13:21:31 +0100
committerBen Brown <ben.brown@codethink.co.uk>2018-02-09 13:18:54 +0000
commit8c04ee6c7ad144d0a2300145c01d652fabaf550a (patch)
treeab15c30518bf5243f70a1764e0c2c9ae7ea6818c
parent7eb45230069015e2dfd4fe0adea9f332daffabe0 (diff)
downloadybd-8c04ee6c7ad144d0a2300145c01d652fabaf550a.tar.gz
Create deployment dir early
-rw-r--r--ybd/rpm.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/ybd/rpm.py b/ybd/rpm.py
index ef47495..2d12747 100644
--- a/ybd/rpm.py
+++ b/ybd/rpm.py
@@ -532,19 +532,18 @@ def deploy_rpm(dn, userdata):
if not os.path.exists(cached_path):
app.log(dn, "WARNING: Missing cached file {}".format(cached_path))
return False
- dstdir = os.path.join(app.config['deployment'],
- 'RPMs', cache_key(userdata['system']))
dstfilename = rpm_deployment_filename(dn, cached_path)
- dstpath = os.path.join(dstdir, dstfilename)
- if not os.path.exists(dstdir):
- os.makedirs(dstdir)
+ dstpath = os.path.join(userdata['dstdir'], dstfilename)
shutil.copyfile(cached_path, dstpath)
app.log(dn, "Copied %s to deployment area" % dstfilename)
return True
def deploy_rpms(system, whitelist=None):
- deploy_results = foreach_def(system, deploy_rpm, {'system': system},
+ dstdir = os.path.join(app.config['deployment'], 'RPMs', cache_key(system))
+ utils.makedirs(dstdir, exist_ok=True)
+ userdata = {'system': system, 'dstdir': dstdir}
+ deploy_results = foreach_def(system, deploy_rpm, userdata,
whitelist=whitelist)
errors = any(not t[1] for t in deploy_results)
if errors: