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-15 14:56:41 +0000
commit402ec0700f3da34a6ab542001eaa4ede2fb75b68 (patch)
treef5824b83adb6491a94148f5b3010d8868c535719
parenta7bd4278e355c78b5197e2df5663f3ce0acf23eb (diff)
downloadmorph-402ec0700f3da34a6ab542001eaa4ede2fb75b68.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()