Hello everyone. I''m running in to trouble setting/changing environment variables for exec resources in 2.6.2. If the environment variable exists before I try to run the command, puppet can''t seem to change it. For example, exec {"foo": environment => "PATH=/blah", command => "/bin/bash -c \"echo \$PATH\"", logoutput => true; } returns the old PATH value. Now, if I make up a new variable that didn''t exist prior to the exec, like MYVAR, it works. exec {"foo2": environment => "MYVAR=MYVAL", command => "/bin/bash -c \"echo \$MYVAR\"", logoutput => true; } returns MYVAL. Here''s where it gets weird. I get the same exact behavior if I set the variable in the bash command string. exec {"foo3": command => "/bin/bash -c \"export PATH=/blah; echo \$PATH\"", logoutput => true; } returns the old PATH value. While this returns MYVAL, exec {"foo4": command => "/bin/bash -c \"export MYVAR=MYVAL; echo \$MYVAR\"", logoutput => true; } Is this an actual bug or am I missing something? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Oct 13, 2010, at 2:16 PM, Carl Caum wrote:> Hello everyone. I''m running in to trouble setting/changing environment variables for exec resources in 2.6.2. If the environment variable exists before I try to run the command, puppet can''t seem to change it. For example, > > exec {"foo": > environment => "PATH=/blah", > command => "/bin/bash -c \"echo \$PATH\"", > logoutput => true; > } > > returns the old PATH value. Now, if I make up a new variable that didn''t exist prior to the exec, like MYVAR, it works. > > exec {"foo2": > environment => "MYVAR=MYVAL", > command => "/bin/bash -c \"echo \$MYVAR\"", > logoutput => true; > } > > returns MYVAL. Here''s where it gets weird. I get the same exact behavior if I set the variable in the bash command string. > > exec {"foo3": > command => "/bin/bash -c \"export PATH=/blah; echo \$PATH\"", > logoutput => true; > } > > returns the old PATH value. While this returns MYVAL, > > exec {"foo4": > command => "/bin/bash -c \"export MYVAR=MYVAL; echo \$MYVAR\"", > logoutput => true; > } > > Is this an actual bug or am I missing something?PATH is usually declared using the resource variable "path" so I wouldn''t be surprised if it acts strange if you declare it in "environment". Might be a bug, but it wouldn''t surprise me. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Well yes, that''s true. But I wanted to use an example variable that I knew all systems would have. On Oct 13, 2010, at 5:16 PM, Patrick <kc7zzv@gmail.com> wrote:> > On Oct 13, 2010, at 2:16 PM, Carl Caum wrote: > >> Hello everyone. I''m running in to trouble setting/changing environment variables for exec resources in 2.6.2. If the environment variable exists before I try to run the command, puppet can''t seem to change it. For example, >> >> exec {"foo": >> environment => "PATH=/blah", >> command => "/bin/bash -c \"echo \$PATH\"", >> logoutput => true; >> } >> >> returns the old PATH value. Now, if I make up a new variable that didn''t exist prior to the exec, like MYVAR, it works. >> >> exec {"foo2": >> environment => "MYVAR=MYVAL", >> command => "/bin/bash -c \"echo \$MYVAR\"", >> logoutput => true; >> } >> >> returns MYVAL. Here''s where it gets weird. I get the same exact behavior if I set the variable in the bash command string. >> >> exec {"foo3": >> command => "/bin/bash -c \"export PATH=/blah; echo \$PATH\"", >> logoutput => true; >> } >> >> returns the old PATH value. While this returns MYVAL, >> >> exec {"foo4": >> command => "/bin/bash -c \"export MYVAR=MYVAL; echo \$MYVAR\"", >> logoutput => true; >> } >> >> Is this an actual bug or am I missing something? > > PATH is usually declared using the resource variable "path" so I wouldn''t be surprised if it acts strange if you declare it in "environment". Might be a bug, but it wouldn''t surprise me. > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.