summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-04-15 14:45:42 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2015-04-20 14:07:42 +0000
commitf42e2af871873653c70715d06d0cf6a9102d1ff7 (patch)
tree5ce02e850729c36889c0592a5e55452eb6d4fbf8
parent3ac7e7579bec1d3210af2ada6c03d4e7d5e454bf (diff)
downloadmorph-f42e2af871873653c70715d06d0cf6a9102d1ff7.tar.gz
Flush temporary file after download
Without this, stratum files can turn up in the cache as 0 bytes long, which breaks everything. Change-Id: I4c0712d97a372232360113e388a09c61f2e7b875
-rw-r--r--morphlib/ostreeartifactcache.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/morphlib/ostreeartifactcache.py b/morphlib/ostreeartifactcache.py
index 230460f8..50af1437 100644
--- a/morphlib/ostreeartifactcache.py
+++ b/morphlib/ostreeartifactcache.py
@@ -66,6 +66,7 @@ class OSTreeArtifactCache(object):
try:
temporary_download = tempfile.NamedTemporaryFile(dir=self.cachedir)
shutil.copyfileobj(handle, temporary_download)
+ temporary_download.flush()
yield temporary_download.name
finally:
temporary_download.close()