40 lines
1.4 KiB
Diff
40 lines
1.4 KiB
Diff
|
Subject: urlfetcher: Force a flush after writing to a file
|
||
|
From: Fabiano Fidêncio fidencio@redhat.com Mon Aug 5 13:47:25 2019 +0200
|
||
|
Date: Tue Aug 6 17:59:05 2019 -0400:
|
||
|
Git: 5324582747a57c5df1574ed99dbe20d3d0f65747
|
||
|
|
||
|
While downloading really small files, on some file systems, the files
|
||
|
may not be flushed on time for whatever reason they've been downloaded.
|
||
|
|
||
|
This issue was noticed after trying to perform unattended installations
|
||
|
and noticing that some files, particularly really small ones, where just
|
||
|
empty.
|
||
|
|
||
|
While the original issue would be fixed by doing the flush on
|
||
|
_HTTPURLFetcher::_write(), let's also force it on _URLFetcher::_write()
|
||
|
to do the same.
|
||
|
|
||
|
Reviewed-by: Cole Robinson <crobinso@redhat.com>
|
||
|
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
|
||
|
|
||
|
diff --git a/virtinst/install/urlfetcher.py b/virtinst/install/urlfetcher.py
|
||
|
index e48c801c..07f8b5ea 100644
|
||
|
--- a/virtinst/install/urlfetcher.py
|
||
|
+++ b/virtinst/install/urlfetcher.py
|
||
|
@@ -156,6 +156,7 @@ class _URLFetcher(object):
|
||
|
fileobj.write(buff)
|
||
|
total += len(buff)
|
||
|
self.meter.update(total)
|
||
|
+ fileobj.flush()
|
||
|
return total
|
||
|
|
||
|
def _grabber(self, url):
|
||
|
@@ -291,6 +292,7 @@ class _HTTPURLFetcher(_URLFetcher):
|
||
|
fileobj.write(data)
|
||
|
total += len(data)
|
||
|
self.meter.update(total)
|
||
|
+ fileobj.flush()
|
||
|
return total
|
||
|
|
||
|
|