mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-03-05 20:58:31 +03:00
urlfetcher: Force a flush after writing to a file
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>
This commit is contained in:
parent
7f8648c53d
commit
5324582747
@ -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
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user