Skip to content

Commit c2b760f

Browse files
[sonic_package_manager] flush once finished saving docker image into temporary file (#1638)
Since installation happens inside context manager "with tempfile.NamedTemporaryFile()" it may be that depending on file size/number of writes the docker image isn't fully written to the disk. In practice a small test docker image was succesfully migrated but when trying with larger onces it started to file. This change fixes the issue by adding a flush. Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
1 parent cd69473 commit c2b760f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

sonic_package_manager/manager.py

+1
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ def migrate_package(old_package_entry,
638638
with tempfile.NamedTemporaryFile('wb') as file:
639639
for chunk in image.save(named=True):
640640
file.write(chunk)
641+
file.flush()
641642

642643
self.install(tarball=file.name)
643644
else:

0 commit comments

Comments
 (0)