> Hi I'm trying to setting http_proxy environment variable by adding it
> to the /etc/environment file.
>
> I was wondering how I can force puppet to reload this file whenever
> the file changes.
>
> I have tried a few things and none of them have worked,
>
> 1.)
> exec { "source_environment":
> command => "source /etc/environment",
> subscribe => File["/etc/environment"],
> refreshonly => true
> }
>
>
> 2.)
> exec { "source /etc/environment":
> subscribe => File["/etc/environment"],
> refreshonly => true
> }
>
> 3.)
> exec { "export http_proxy="http://localhost:3128"":
> subscribe => File["/etc/environment"],
> refreshonly => true
> }
>
>
> Is there a better way to do this? I just need to ensure that the
> environment var http_proxy is globally set.
No subshell will be able to modify the parent's environment, which is
what you're after. Try setting environment variables in the Puppet
process's environment:
rcrow...@wd-40:~$ puppet apply test.pp
warning: Could not retrieve fact fqdn
notice: /Stage[main]//Exec[sh -c 'echo $HOOAH >/tmp/foo']/returns:
executed successfully
rcrow...@wd-40:~$ cat /tmp/foo
rcrow...@wd-40:~$ HOOAH=hooah puppet apply test.pp
warning: Could not retrieve fact fqdn
notice: /Stage[main]//Exec[sh -c 'echo $HOOAH >/tmp/foo']/returns:
executed successfully
rcrow...@wd-40:~$ cat /tmp/foo
hooah
rcrow...@wd-40:~$
Setting values in /etc/environment will probably work provided you
restart the Puppet process in question after the contents of that file
have been set.
Hope that helps,
Richard
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.