On Sunday, September 30, 2012 11:40:42 PM UTC-5, drew khoury wrote:
May have spoken too soon.
If I set the env variable, and I'm manually logged, then I run puppet all is good.
I'm still not clear on how I set the env variable when puppet is invoked from Vagrant (this might end up being a question for Vagrant not puppet?).
Yes, that would be a Vagrant question. You could, however, have Vagrant invoke a wrapper script that sets the desired variable instead of invoking "puppet apply" directly. I'm not sure how that differs from what you tried but it should work. Something like this:
#!/bin/bash
export http_proxy=my.proxy
puppet apply "$@"
Setting the env variable in a bash script invoked via the puppet manifest proved to be useless, as it doesn't have any scope OUTSIDE the bash script.
Indeed not. That's why you need to put the Puppet invocation inside the script.
I've tried a combination of setting the variable in /home/vagrant/.bashrc AND keeping the env via env_keep in sudoers but I'm not sure I'm understanding how Vagrant is invoking Puppet.
Command runners typically are very careful and selective about the environment they provide to commands they run. Puppet is a good example, and likely Vagrant is, too. Such programs normally have a way to configure the environment for each command along with the command itself, and they usually provide little or nothing else in those environments. In particular, they normally do not pass on their own environment to commands.
John