@@ -218,9 +218,10 @@ def add_volumes(self, pathmapper, runtime, secret_store=None):
218
218
if not vol .staged :
219
219
continue
220
220
host_outdir_tgt = None # type: Optional[Text]
221
- if vol .target .startswith (container_outdir + "/" ):
221
+ if vol .target .startswith (container_outdir + "/" ):
222
222
host_outdir_tgt = os .path .join (
223
223
host_outdir , vol .target [len (container_outdir )+ 1 :])
224
+
224
225
if vol .type in ("File" , "Directory" ):
225
226
if not vol .resolved .startswith ("_:" ):
226
227
_check_docker_machine_path (docker_windows_path_adjust (
@@ -244,7 +245,8 @@ def add_volumes(self, pathmapper, runtime, secret_store=None):
244
245
elif vol .type == "WritableDirectory" :
245
246
if vol .resolved .startswith ("_:" ):
246
247
if host_outdir_tgt :
247
- os .makedirs (host_outdir_tgt , 0o0755 )
248
+ if not os .path .exists (host_outdir_tgt ):
249
+ os .makedirs (host_outdir_tgt , 0o0755 )
248
250
else :
249
251
raise WorkflowException (
250
252
"Unable to compute host_outdir_tgt for "
@@ -268,6 +270,9 @@ def add_volumes(self, pathmapper, runtime, secret_store=None):
268
270
else :
269
271
contents = vol .resolved
270
272
if host_outdir_tgt :
273
+ dirname = os .path .dirname (host_outdir_tgt )
274
+ if not os .path .exists (dirname ):
275
+ os .makedirs (dirname , 0o0755 )
271
276
with open (host_outdir_tgt , "wb" ) as file_literal :
272
277
file_literal .write (contents .encode ("utf-8" ))
273
278
else :
0 commit comments