Skip to content

Commit

Permalink
Fix scope issue
Browse files Browse the repository at this point in the history
Increase livetime of the the compressor instances
to the livetime of RootImportOCI. They create temporary
files which are referenced later and need to live longer
than the block they got created in
  • Loading branch information
schaefi committed Nov 27, 2024
1 parent fcc9b20 commit d12c59c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kiwi/system/root_import/oci.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class RootImportOCI(RootImportBase):
"""
def post_init(self, custom_args: Dict[str, str]):
self.archive_transport = custom_args['archive_transport']
self.compressed_image_files: List[Compress] = []

def sync_data(self):
"""
Expand Down Expand Up @@ -90,6 +91,11 @@ def _get_image_urls(self) -> List[str]:
image_urls: List[str] = []
for image_file in self.image_files:
compressor = Compress(image_file)
# Increase livetime of the the compressor instances
# to the livetime of RootImportOCI. They create
# temporary files which are referenced later and
# need to live longer than this loop block
self.compressed_image_files.append(compressor)
if compressor.get_format():
compressor.uncompress(True)
uncompressed_image = compressor.uncompressed_filename
Expand Down

0 comments on commit d12c59c

Please sign in to comment.