Skip to content

Commit 9ca999e

Browse files
authored
Merge pull request #9 from bnusunny/fix-finch-symlink-mount
fix: restore symlinks at container delete time
2 parents 391a2ec + 1473a28 commit 9ca999e

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

samcli/local/docker/container.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,11 @@ def delete(self):
449449
shutil.rmtree(self._host_tmp_dir)
450450
LOG.debug("Successfully removed temporary directory %s on the host.", self._host_tmp_dir)
451451

452+
# Restore any symlinks that were temporarily replaced with directories
453+
# during container creation for mount compatibility (Finch/containerd).
454+
# Done at delete time so the bind mounts remain valid for the container's lifetime.
455+
self._restore_mapped_symlinks()
456+
452457
self.id = None
453458

454459
def start(self, input_data=None):
@@ -486,11 +491,6 @@ def start(self, input_data=None):
486491
if "Ports are not available" in str(ex):
487492
raise PortAlreadyInUse(ex.explanation.decode()) from ex
488493
raise ex
489-
finally:
490-
# Restore any symlinks that were temporarily replaced with directories
491-
# during container creation for mount compatibility (Finch/containerd).
492-
# Must happen after start() since containerd resolves mounts at start time.
493-
self._restore_mapped_symlinks()
494494

495495
def _initialize_concurrency_control(self):
496496
"""

0 commit comments

Comments
 (0)