From 0548b32d323f6d68122d06c2eb3d06e25c67fae2 Mon Sep 17 00:00:00 2001 From: fabriziopandini Date: Thu, 23 Jun 2016 22:27:30 +0200 Subject: [PATCH] Add support for proxy Vagrantfile detects proxy settings from env variables in host; if a proxy is set, proxy settings are injected in the vm using vagrant-proxyconf plugin --- scripts/vagrant/zeppelin-dev/Vagrantfile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/vagrant/zeppelin-dev/Vagrantfile b/scripts/vagrant/zeppelin-dev/Vagrantfile index 1da7be3d319..ce98ba84315 100644 --- a/scripts/vagrant/zeppelin-dev/Vagrantfile +++ b/scripts/vagrant/zeppelin-dev/Vagrantfile @@ -19,6 +19,13 @@ # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = "2" +## proxy settings +################################################ +http_proxy = ENV.fetch('http_proxy', '') +https_proxy = ENV.fetch('https_proxy', '') +no_proxy = ENV.fetch('no_proxy', 'localhost,127.0.0.1') +proxy_on = !http_proxy.empty? and !https_proxy.empty? + Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # All Vagrant configuration is done here. The most common configuration # options are documented and commented below. For a complete reference, @@ -28,6 +35,16 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # ubuntu/trusty64 Official Ubuntu Server 14.04 LTS (Trusty Tahr) builds config.vm.box = "ubuntu/trusty64" + # Vagrant Plugin Configuration: vagrant-proxyconf + if Vagrant.has_plugin?("vagrant-proxyconf") + if proxy_on + # set proxy + config.proxy.http = http_proxy + config.proxy.https = https_proxy + config.proxy.no_proxy = no_proxy + end + end + # Disable automatic box update checking. If you disable this, then # boxes will only be checked for updates when the user runs # `vagrant box outdated`. This is not recommended.