Skip to content

Commit

Permalink
Setting for the proxy environment - isolated change
Browse files Browse the repository at this point in the history
  • Loading branch information
kbarczyn committed Jul 16, 2013
1 parent e63734b commit b692d9e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/vagrant-omnibus/action/install_chef.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,22 @@ def installed_version
end

def install(version)
if ENV["http_proxy"]
http_proxy = "export http_proxy=" + ENV["http_proxy"]
https_proxy = "export https_proxy=" + ENV["https_proxy"]
if ENV["no_proxy"]
no_proxy = "export no_proxy=" + ENV["no_proxy"]
end
end

command = <<-INSTALL_OMNIBUS
#{http_proxy}
#{https_proxy}
#{no_proxy}
if command -v wget &>/dev/null; then
wget -qO- #{INSTALL_SH} | sudo bash -s -- -v #{version}
wget -qO- #{INSTALL_SH} | sudo bash -E -s -- -v #{version}
elif command -v curl &>/dev/null; then
curl -L #{INSTALL_SH} -v #{version} | sudo bash
curl -L #{INSTALL_SH} -v #{version} | sudo -E bash
else
echo "Neither wget nor curl found. Please install one." >&2
exit 1
Expand Down

5 comments on commit b692d9e

@tknerr
Copy link

@tknerr tknerr commented on b692d9e Jul 24, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kbarczyn @schisamo I don't think we can use ENV['http_proxy'] here. This is evaluated on the host, not the vagrant vm, and the vagrant vm does not necessarily have the same proxy settings as the host. This might be the case for a local virtualbox vm, but not for a vagrant vm in the cloud (e.g. via vagrant-aws or vagrant-rackspace).

Suggestion: it should either be a separate env var on the host, e.g. VAGRANT_HTTP_PROXY, or it should be a configuration option of vagrant-omnibus.

@tknerr
Copy link

@tknerr tknerr commented on b692d9e Jul 24, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw: as a workaround I tried configuring the proxy on the VM via a shell provisioner first, but this does not work because vagrant-omnibus kicks in before any provisioner.

@schisamo would it be possible to hook in vagrant-omnibus specifically before the :chef_client and :chef_solo provisioners, so that other provisioners can without vagrant-omnibus kicking in?

@sprevrha
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't work:

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

export http_proxy=XXX:8080
export https_proxy=XXX:8080

@gad0lin
Copy link
Owner

@gad0lin gad0lin commented on b692d9e Aug 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sprevha: I was using it successfully. Vagrant doesn't want to start? You get exception when starting?

I like the option with VAGRANT_HTTP_PROXY.

@tknerr
Copy link

@tknerr tknerr commented on b692d9e Aug 28, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kbarczyn @schisamo VAGRANT_ENV_HTTP_PROXY as the name for the environment variable would be in line with tmatilai/vagrant-proxyconf#6

Please sign in to comment.