Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Podman compatibility" #251

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docker_squash/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,12 @@ def _before_squashing(self):
try:
number_of_layers = int(self.from_layer)

self.log.debug("We detected number of layers as the argument to squash")
self.log.debug(
f"We detected number of layers ({number_of_layers}) as the argument to squash"
)
except ValueError:
self.log.debug("We detected layer as the argument to squash")

squash_id = self._squash_id(self.from_layer)
self.log.debug(f"We detected layer ({squash_id}) as the argument to squash")

if not squash_id:
raise SquashError(
Expand Down
7 changes: 5 additions & 2 deletions docker_squash/squash.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,11 @@ def squash(self, image: Image):
# Load squashed image into Docker
image.load_squashed_image()

# Clean up all temporary files
image.cleanup()
# If development mode is not enabled, make sure we clean up the
# temporary directory
if not self.development:
# Clean up all temporary files
image.cleanup()

# Remove the source image - this is the only possible way
# to remove orphaned layers from Docker daemon at the build time.
Expand Down
5 changes: 2 additions & 3 deletions docker_squash/v2_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ class V2Image(Image):
def _before_squashing(self):
super(V2Image, self)._before_squashing()

# New OCI Archive format type
self.oci_format = True

# Read old image manifest file
self.old_image_manifest = self._get_manifest()
self.log.debug(
Expand Down Expand Up @@ -378,6 +375,8 @@ def _generate_image_metadata(self):

def _get_manifest(self):
if os.path.exists(os.path.join(self.old_image_dir, "index.json")):
# New OCI Archive format type
self.oci_format = True
# Not using index.json to extract manifest details as while the config
# sha could be extracted via some indirection i.e.
#
Expand Down