Derek Strickland
2013-Sep-20 20:18 UTC
[Puppet Users] Execute Mono exe that depends on an environment variable
I have a script that I execute to run a mono exe during a setup process. I would like to automate that with puppet but the exe depends on an environment variable being set or it will fail. My setup.sh file looks like this. export MY_ENV_VAR=$HOME/target_dir /usr/mono/bin/mono $HOME/path_to_exe/Setup.exe this fails because well $HOME is meaningless in a puppet context. Here''s is what I would like to do. exec { ''myscript'': command => "/bin/sh /some_path/scripts/setup.sh", } I can''t change the mono exe to not rely on special environment variable. That isn''t an option. So in summary I need to be able to set a special env variable for the exec context and I have to be able to dynamically change the path to the exe because each users home directory will be different. I searched for a while but now my eyes are just crossed. Any ideas? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
jcbollinger
2013-Sep-23 13:51 UTC
[Puppet Users] Re: Execute Mono exe that depends on an environment variable
On Friday, September 20, 2013 3:18:20 PM UTC-5, Derek Strickland wrote:> > I have a script that I execute to run a mono exe during a setup process. > I would like to automate that with puppet but the exe depends on an > environment variable being set or it will fail. My setup.sh file looks > like this. > > export MY_ENV_VAR=$HOME/target_dir > /usr/mono/bin/mono $HOME/path_to_exe/Setup.exe > > this fails because well $HOME is meaningless in a puppet context. Here''s > is what I would like to do. > > exec { ''myscript'': > command => "/bin/sh /some_path/scripts/setup.sh", > } > > I can''t change the mono exe to not rely on special environment variable. > That isn''t an option. > > So in summary I need to be able to set a special env variable for the exec > context and I have to be able to dynamically change the path to the exe > because each users home directory will be different. I searched for a > while but now my eyes are just crossed. > > Any ideas? > >This is what the "environment" parameter of the Exec resource type is for. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.