File tree 5 files changed +21
-1
lines changed
5 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ config:
24
24
workspace_dirs : $ramble/var/ramble/workspaces
25
25
report_dirs : ~/.ramble/reports
26
26
include_phase_dependencies : false
27
+ resolve_variables_in_subprocesses : false
27
28
spack :
28
29
install :
29
30
flags : --reuse
Original file line number Diff line number Diff line change @@ -441,6 +441,12 @@ def make_argument_parser(**kwargs):
441
441
help = "when running in a workspace, use its application repository" ,
442
442
)
443
443
444
+ parser .add_argument (
445
+ "--resolve-variables-in-subprocesses" ,
446
+ action = "store_true" ,
447
+ help = "Allow resolution of environment variables when launching subprocesses" ,
448
+ )
449
+
444
450
parser .add_argument (
445
451
"-k" ,
446
452
"--insecure" ,
@@ -612,6 +618,10 @@ def setup_main_options(args):
612
618
logger .warn ("You asked for --insecure. Will NOT check SSL certificates." )
613
619
ramble .config .set ("config:verify_ssl" , False , scope = "command_line" )
614
620
621
+ # If the user asked for it allow env-vars to resolve in subprocess calls
622
+ if args .resolve_variables_in_subprocesses :
623
+ ramble .config .set ("config:resolve_variables_in_subprocesses" , True , scope = "command_line" )
624
+
615
625
# Use the ramble config command to handle parsing the config strings
616
626
for config_var in args .config_vars or []:
617
627
ramble .config .add (fullpath = config_var , scope = "command_line" )
Original file line number Diff line number Diff line change @@ -555,6 +555,8 @@ def __init__(
555
555
def _execute (self ):
556
556
super ()._execute ()
557
557
558
+ resolve_env_vars = ramble .config .get ("config:resolve_variables_in_subprocesses" , False )
559
+
558
560
if not self .suppress_run_header :
559
561
logger .all_msg ("Running executors..." )
560
562
@@ -568,6 +570,8 @@ def _execute(self):
568
570
569
571
app_inst .add_expand_vars (self .workspace )
570
572
exec_str = app_inst .expander .expand_var (self .executor )
573
+ if resolve_env_vars :
574
+ exec_str = os .path .expandvars (exec_str )
571
575
exec_parts = shlex .split (exec_str )
572
576
exec_name = exec_parts [0 ]
573
577
exec_args = exec_parts [1 :]
Original file line number Diff line number Diff line change 116
116
},
117
117
"additionalProperties" : False ,
118
118
},
119
+ "resolve_variables_in_subprocesses" : {
120
+ "type" : "boolean" ,
121
+ "default" : False ,
122
+ "additionalProperties" : False ,
123
+ },
119
124
},
120
125
"additionalProperties" : False ,
121
126
}
Original file line number Diff line number Diff line change @@ -264,7 +264,7 @@ complete -o bashdefault -o default -F _bash_completion_ramble ramble
264
264
_ramble () {
265
265
if $list_options
266
266
then
267
- RAMBLE_COMPREPLY=" -h --help -H --all-help --color -c --config -C --config-scope -d --debug --disable-passthrough -N --disable-logger -P --disable-progress-bar --timestamp --pdb -w --workspace -D --workspace-dir -W --no-workspace --use-workspace-repo -k --insecure -l --enable-locks -L --disable-locks -m --mock --mock-applications --mock-modifiers --mock-package-managers --mock-workflow-managers --mock-base-applications --mock-base-modifiers --mock-base-package-managers --mock-base-workflow-managers -p --profile --sorted-profile --lines --profile-restrictions -v --verbose --stacktrace -V --version --print-shell-vars"
267
+ RAMBLE_COMPREPLY=" -h --help -H --all-help --color -c --config -C --config-scope -d --debug --disable-passthrough -N --disable-logger -P --disable-progress-bar --timestamp --pdb -w --workspace -D --workspace-dir -W --no-workspace --use-workspace-repo --resolve-variables-in-subprocesses - k --insecure -l --enable-locks -L --disable-locks -m --mock --mock-applications --mock-modifiers --mock-package-managers --mock-workflow-managers --mock-base-applications --mock-base-modifiers --mock-base-package-managers --mock-base-workflow-managers -p --profile --sorted-profile --lines --profile-restrictions -v --verbose --stacktrace -V --version --print-shell-vars"
268
268
else
269
269
RAMBLE_COMPREPLY=" attributes clean commands config debug deployment docs edit help info license list mirror on python repo results software-definitions style unit-test workspace"
270
270
fi
You can’t perform that action at this time.
0 commit comments