Skip to content

Commit

Permalink
[sonic_package_manager] flush once finished saving docker image into …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
stepanblyschak authored May 30, 2021
1 parent cd69473 commit c2b760f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions sonic_package_manager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ def migrate_package(old_package_entry,
with tempfile.NamedTemporaryFile('wb') as file:
for chunk in image.save(named=True):
file.write(chunk)
file.flush()

self.install(tarball=file.name)
else:
Expand Down

0 comments on commit c2b760f

Please sign in to comment.