Skip to content

Commit b42abe3

Browse files
committed
Fixed another symlinking issue with Docker + staged files from InitialWorkDirRequirement
1 parent 8d7e75d commit b42abe3

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

cwltool/docker.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,9 @@ def add_file_or_directory_volume(
248248
"""Append volume a file/dir mapping to the runtime option list."""
249249
if not volume.resolved.startswith("_:"):
250250
_check_docker_machine_path(volume.resolved)
251-
self.append_volume(runtime, volume.resolved, volume.target)
251+
self.append_volume(
252+
runtime, volume.resolved, volume.target, writable=volume.staged
253+
)
252254

253255
def add_writable_file_volume(
254256
self,

cwltool/job.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,13 @@ def relink_initialworkdir(
9393
continue
9494
host_outdir_tgt = os.path.join(host_outdir, vol.target[len(container_outdir) + 1 :])
9595
if os.path.islink(host_outdir_tgt) or os.path.isfile(host_outdir_tgt):
96-
try:
97-
os.remove(host_outdir_tgt)
98-
except PermissionError:
99-
pass
96+
subprocess.run(["chmod", "777", host_outdir_tgt], check=True)
97+
os.remove(host_outdir_tgt)
10098
elif os.path.isdir(host_outdir_tgt) and not vol.resolved.startswith("_:"):
99+
subprocess.run(["chmod", "777", host_outdir_tgt], check=True)
101100
shutil.rmtree(host_outdir_tgt)
102101
if not vol.resolved.startswith("_:"):
103-
try:
104-
os.symlink(vol.resolved, host_outdir_tgt)
105-
except FileExistsError:
106-
pass
107-
102+
os.symlink(vol.resolved, host_outdir_tgt)
108103

109104
def neverquote(string: str, pos: int = 0, endpos: int = 0) -> Optional[Match[str]]:
110105
return None

0 commit comments

Comments
 (0)