PATH and MODULEPATH changed in form.yml.erb

Hello,
I’m trying to launch a command line tool from within my form.yml.erb. It relies on being on certain modules being loaded/loadable and specific environment variables such as PATH. When I build it in my shell using “erb -T - form.yml.erb” it produces the correct output. When I use it within the OOD sandbox, PATH has been changed and MODULEPATH is no longer defined.

The PATH got changed to this: “/opt/ood/ondemand/root/usr/share/gems/2.5/bin:/opt/rh/rh-nodejs10/root/usr/bin:/opt/rh/rh-ruby25/root/usr/local/bin:/opt/rh/rh-ruby25/root/usr/bin:/opt/rh/httpd24/root/usr/bin:/opt/rh/httpd24/root/usr/sbin:/opt/ood/ondemand/root/usr/bin:/opt/ood/ondemand/root/usr/sbin:/sbin:/bin:/usr/sbin:/usr/bin”

What do you recommend as the correct way to set up my cluster to enable these values to be preserved or to work around this?

If you need any snippets of my files, I’m more than happy to provide them.

Thank you for you help!
Glenn Morton
Seattle Children’s Hospital

Hi!

Could you please show me the command you’re running in form.yml.erb?

So OOD’s environment is not a login shell. You could try wrapping the command in bash -lc like

bash -lc /fullPath/command

The bash -l will create a new environment for the command to be run in, and should help resolve the issue.

That works beautifully! Thank you so much!
In case you were curious these both worked well for executing the command:

  1. cmd = "bash -lc \"voucher\""
    `#{cmd}`
  2. `bash -lc "voucher"`
1 Like