script/vagrant: split into functions - setup proxy
Signed-off-by: Pawel Piatek <pawelx.piatek@intel.com> Change-Id: I82e101afca9e6bc43c49aa6a755e0c3afffb349e Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3711 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
0b46c777bd
commit
e08eae22f6
46
scripts/vagrant/Vagrantfile
vendored
46
scripts/vagrant/Vagrantfile
vendored
@ -25,6 +25,30 @@ def get_box_type(distro)
|
|||||||
return distro_to_type[distro]
|
return distro_to_type[distro]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def setup_proxy(config,distro)
|
||||||
|
return unless ENV['http_proxy']
|
||||||
|
|
||||||
|
if Vagrant.has_plugin?("vagrant-proxyconf")
|
||||||
|
config.proxy.http = ENV['http_proxy']
|
||||||
|
config.proxy.https = ENV['https_proxy']
|
||||||
|
config.proxy.no_proxy = "localhost,127.0.0.1"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Proxyconf does not seem to support FreeBSD boxes or at least it's
|
||||||
|
# docs do not mention that. Set up proxy configuration manually.
|
||||||
|
if distro.include?("freebsd")
|
||||||
|
$freebsd_proxy = <<-SCRIPT
|
||||||
|
sudo -s
|
||||||
|
echo "export http_proxy=#{ENV['http_proxy']}" >> /etc/profile
|
||||||
|
echo "export https_proxy=#{ENV['http_proxy']}" >> /etc/profile
|
||||||
|
echo "pkg_env: {http_proxy: #{ENV['http_proxy']}}" > /usr/local/etc/pkg.conf
|
||||||
|
chown root:wheel /usr/local/etc/pkg.conf
|
||||||
|
chmod 644 /usr/local/etc/pkg.conf
|
||||||
|
SCRIPT
|
||||||
|
config.vm.provision "shell", inline: $freebsd_proxy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
Vagrant.configure(2) do |config|
|
Vagrant.configure(2) do |config|
|
||||||
|
|
||||||
# Pick the right distro and bootstrap, default is fedora30
|
# Pick the right distro and bootstrap, default is fedora30
|
||||||
@ -89,27 +113,7 @@ Vagrant.configure(2) do |config|
|
|||||||
end
|
end
|
||||||
|
|
||||||
# use http proxy if avaiable
|
# use http proxy if avaiable
|
||||||
if ENV['http_proxy']
|
setup_proxy(config, distro)
|
||||||
if Vagrant.has_plugin?("vagrant-proxyconf")
|
|
||||||
config.proxy.http = ENV['http_proxy']
|
|
||||||
config.proxy.https = ENV['https_proxy']
|
|
||||||
config.proxy.no_proxy = "localhost,127.0.0.1"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Proxyconf does not seem to support FreeBSD boxes or at least it's
|
|
||||||
# docs do not mention that. Set up proxy configuration manually.
|
|
||||||
if distro.include?("freebsd")
|
|
||||||
$freebsd_proxy = <<-SCRIPT
|
|
||||||
sudo -s
|
|
||||||
echo "export http_proxy=#{ENV['http_proxy']}" >> /etc/profile
|
|
||||||
echo "export https_proxy=#{ENV['http_proxy']}" >> /etc/profile
|
|
||||||
echo "pkg_env: {http_proxy: #{ENV['http_proxy']}}" > /usr/local/etc/pkg.conf
|
|
||||||
chown root:wheel /usr/local/etc/pkg.conf
|
|
||||||
chmod 644 /usr/local/etc/pkg.conf
|
|
||||||
SCRIPT
|
|
||||||
config.vm.provision "shell", inline: $freebsd_proxy
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# freebsd and clearlinux boxes in order to have spdk sources synced from
|
# freebsd and clearlinux boxes in order to have spdk sources synced from
|
||||||
# host properly will use NFS with "ro" option enabled to prevent changes
|
# host properly will use NFS with "ro" option enabled to prevent changes
|
||||||
|
Loading…
Reference in New Issue
Block a user