Skip to content

Commit 9508896

Browse files
jfennickmr-c
authored andcommitted
Fixed another symlinking issue with Docker + staged files from InitialWorkDirRequirement
1 parent e4b5d92 commit 9508896

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
@@ -236,7 +236,9 @@ def add_file_or_directory_volume(
236236
"""Append volume a file/dir mapping to the runtime option list."""
237237
if not volume.resolved.startswith("_:"):
238238
_check_docker_machine_path(volume.resolved)
239-
self.append_volume(runtime, volume.resolved, volume.target)
239+
self.append_volume(
240+
runtime, volume.resolved, volume.target, writable=volume.staged
241+
)
240242

241243
def add_writable_file_volume(
242244
self,

cwltool/job.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,13 @@ def relink_initialworkdir(
100100
continue
101101
host_outdir_tgt = os.path.join(host_outdir, vol.target[len(container_outdir) + 1 :])
102102
if os.path.islink(host_outdir_tgt) or os.path.isfile(host_outdir_tgt):
103-
try:
104-
os.remove(host_outdir_tgt)
105-
except PermissionError:
106-
pass
103+
subprocess.run(["chmod", "777", host_outdir_tgt], check=True)
104+
os.remove(host_outdir_tgt)
107105
elif os.path.isdir(host_outdir_tgt) and not vol.resolved.startswith("_:"):
106+
subprocess.run(["chmod", "777", host_outdir_tgt], check=True)
108107
shutil.rmtree(host_outdir_tgt)
109108
if not vol.resolved.startswith("_:"):
110-
try:
111-
os.symlink(vol.resolved, host_outdir_tgt)
112-
except FileExistsError:
113-
pass
114-
109+
os.symlink(vol.resolved, host_outdir_tgt)
115110

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

0 commit comments

Comments
 (0)