Closed philippgl closed 3 years ago
I have the same issue on macOS Catalina (10.15.7) with Vagrant 2.2.13. A friend tested this with Vagrant 2.2.7 (also on macOS Catalina) where everything works as expected.
Thanks for reporting. Im sorry to hear this doesn't work on the latest vagrant. Do to time constraints i have not found the time to test this plugin against vagrant >= 2.2.10.
I realize this is not ideal but I would be curious if you vagrant 2.2.9 works? If so, i know this is a lot of ask but of that works is it possible you could stick with that version of vagrant for a while?
I dont have a lot of free time these days so not sure when I'll get to this.
Also could you both please paste your vagrantfiles to this thread. Id love to be able reproduce this with as minimal guessing on my side.
@philippgl - can you please paste the contents of /etc/environment from your vm after vagrant provisions your vm? I dont use or test archlinux so its going to be hard for me to say what could be the issue. Ill need some time to investigate.
@codylane: our Vagrantfile is rather large, the importance part is this:
Vagrant.configure("2") do |config|
config.ssh.forward_agent = true
config.vm.box_check_update = false
config.proxy.http = ENV['http_proxy'] unless ENV['http_proxy'].nil?
config.proxy.https = ENV['https_proxy'] unless ENV['https_proxy'].nil?
config.proxy.no_proxy = ENV['no_proxy'] unless ENV['no_proxy'].nil?
And it is quite visible on 'vagrant up' because after the message "Machine booted and ready!" the message "Configuring proxy environment variables..." does not show up.
Also, after "vagrant up", /etc/environment is empty.
I realize this is not ideal but I would be curious if you vagrant 2.2.9 works? If so, i know this is a lot of ask but of that works is it possible you could stick with that version of vagrant for a while?
This is not as simple as it sounds on MacOS with vagrant installed via brew. Could not see any downgrade path. Sadly.
Vagrant 2.2.9 seems to be available at https://releases.hashicorp.com/vagrant/2.2.9/vagrant_2.2.9_x86_64.dmg, will try to manually install this tomorrow.
@codylane - Sorry I've been MIA - I am looking to upgrade Vagrant soon, so I can try to help look into this, see why things aren't hooking up as expected. I'll post here as soon as I can.
For what it is worth is possible to downgrade a homebrew package or cask. I'm not sure it is possible to pin a cask from being upgraded. I searched and searched but had no luck.
NOTE: if the package is not a cask, then you can do brew pin <package>
where <package>
is the package and version you want to pin.
It works on 2.2.10 and that is what I am using now. I can also post the contents of my /etc/environment tomorrow, when I am back in the office.
I think I know what the problem is but I'll need more time to investigate.
But yeah, I'd still like to see /etc/environment
from your VM as well as
VAGRANT_LOG=debug vagrant provision
if your VM is already up and provisioned.
ORVAGRANT_LOG=debug vagrant up
if your VM is powered off or not created.The debug log is insanely huge, but it can be valuable. Before posting make sure it doesn't contain any personal or sensitive data especially if you are behind a authenticated proxy.
I also confirmed as well during my lunch break that Vagrant 2.2.10 passed a couple integration tests and unit tests. I'm going to go ahead and update the Gemfile and Travis to use 2.2.10 since we know that this version works.
Sadly, I didn't have the same luck testing vagrant-proxy config with Vagrant versions 2.2.11
, 2.2.12
and 2.2.13
.
I'll need to spend more time with Vagrant's Changelog to see what the heck they changed and or introduced. I'm growing a little wary about how hashicorp is releasing versions of Vagrant. It's not the first time they have released without also implementing tests for the things they've changed. This has been problematic since vagrant 2.2.5. 2.2.9 was stable for a while.
As I use libvirt as default provider I used VAGRANT_LOG=debug vagrant up --provider virtualbox &> vagrant-up-virtualbox-2.2.13.txt
to generate vagrant-up-virtualbox-2.2.13.txt.
The file /etc/environment
does not exist.
With vagrant 2.2.10 the log looks like this:
vagrant-up-virtualbox-2.2.10.txt.
Thank you for looking into this.
@codylane: thanks for the gist to downgrade vagrant. Now with vagrant 2.2.10 proxyconf works as expected.
Also, thanks to you and @chucknelson for responding to this issue quite fast.
There is an upstream report, which is likely related: https://github.com/hashicorp/vagrant/issues/12035 There seem to be many plugins broken right now. https://github.com/hashicorp/vagrant/commit/157db39938d36e977c1d9f71bc4b30b2b2bae8fe seems to fix it for some other plugins, but I have never build Vagrant, so I don't know how to check, whether this also fixed this issue.
Wow, just wow, this is awesome folks. Thank you so much for doing a little homework and providing details here. I cannot say thank you enough. The extra context has been very valuable so far.
Based off this upstream bug report
There is an upstream report, which is likely related: hashicorp/vagrant#12035 There seem to be many plugins broken right now. hashicorp/vagrant@157db39 seems to fix it for some other plugins, but I have never build Vagrant, so I don't know how to check, whether this also fixed this issue.
I did little further investigating and it does look like hashicorp has merged in a potential fix into their main branch (just a few hours ago) so I suspect we might see Vagrant 2.2.14
being released soon?!
If we don't see Vagrant 2.2.14 released in a few days, I'll say we can discuss plan b, but I don't want to distract anyone with that just yet.
Woot, Vagrant 2.2.14 has been released. Testing now. After reviewing the changes in more detail, i'm not convinced that the issue, reported here has been fixed but I hope to confirm shortly. Thank you for your patience.
Good news folks:
2.2.14
now.I'm going to call this officially ready to upgrade to 2.2.14, repair or reinstall your vagrant plugins as needed, you'll only need too if Vagrant tells you too, after your upgrade.
I'll commit these tests to the master. Since there are not vagrant-proxyconf changes I won't be cutting a new release.
Here's proof of passing unit tests.
$ be rspec
MyBase
#skip?
when attempting to configure a app proxy that is not defined
is expected to eq false
when config.proxy.enabled[:my_base] = false
is expected to eq true
when config.proxy.enabled[:my_base] = true
is expected to eq false
when config.proxy.enabled[:my_base] = {}
is expected to eq false
when config.proxy.enabled[:my_base] = {:enabled => false, :skip => false}
is expected to eq false
when config.proxy.enabled[:my_base] = {:enabled => true, :skip => false}
is expected to eq false
when config.proxy.enabled[:my_base] = {:enabled => true, :skip => true}
is expected to eq true
when config.proxy.enabled[:my_base] = {:enabled => false, :skip => true}
is expected to eq true
when config.proxy.enabled = false
is expected to eq true
when config.proxy.enabled = true
is expected to eq false
when config.proxy.enable[:my_base] = {:enabled => true} and :skip key is missing
is expected to eq false
VagrantPlugins::ProxyConf::Action::ConfigureAptProxy
#config_name
is expected to eq "apt_proxy"
#unconfigure_machine
when proxy is disabled
should remove file: "/etc/apt/apt.conf.d/01proxy" and return true
when not on a supported OS
#unconfigure_machine should return false
#skip?
when config.proxy.enabled[:apt] = false
is expected to eq true
when config.proxy.enabled[:apt] = true
is expected to eq false
when config.proxy.enabled[:apt] = {:enabled => false, :skip => false}
is expected to eq false
when config.proxy.enabled[:apt] = {:enabled => true, :skip => false}
is expected to eq false
when config.proxy.enabled[:apt] = {:enabled => true, :skip => true}
is expected to eq true
when config.proxy.enabled[:apt] = {:enabled => false, :skip => true}
is expected to eq true
when config.proxy.enabled = false
is expected to eq true
when config.proxy.enabled = true
is expected to eq false
VagrantPlugins::ProxyConf::Action::ConfigureChefProxy
#configure_chef
with no configurations
leaves all to nil
with specified default configurations
configures chef
with specified default configurations in URI encoded
configures chef
with specified chef configurations
won't override chef config
configures unset proxies
when user wants to disable the configured chef proxy and does not unset the configured proxy variables
should unconfigure chef proxy
VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy
#config_name
is expected to eq "docker_proxy"
#configure_machine
when docker is not supported
return nil
when docker is supported
and when /home/vagrant/.docker/config.json has proxy configuration
update /home/vagrant/.docker/config.json
and when configuring systemd
when directory: /etc/systemd/system/docker.service.d does not exist
should create directory: /etc/systemd/system/docker.service.d
#docker_client_config
when not supported
is expected to eq nil
when supported
when /home/vagrant/.docker/config.json exists
is expected to eq true
when /home/vagrant/.docker/config.json does not exist
is expected to eq "{}"
#update_docker_client_config
when #supports_config_json? returns false
return nil
when #docker_client_config returns nil
return nil
when /home/vagrant/.docker/config.json is supported
when configuration is disabled
is expected to eq "{\n \"proxies\": {\n \"default\": {\n }\n }\n}"
when configuration is enabled
is expected to eq "{\n \"proxies\": {\n \"default\": {\n \"httpProxy\": \"http://proxy-server-01.example.com:8...y\": \"https://proxy-server-01.example.com:8080\",\n \"noProxy\": \"localhost\"\n }\n }\n}"
#unconfigure_machine
when not supported
return nil
when supported
when config is enabled
return true
when config is disabled
should disable proxy configuration
#docker_version
when not supported
is expected to eq nil
when supported parse
"Docker version 17.05.0-ce, build 89658be"
is expected to eq [17, 5, 0]
"Docker version 18.09.0, build 4d60db4"
is expected to eq [18, 9, 0]
#supports_config_json?
when not supported
returns false
when supported
given docker_version is 18.09.1, return true
given docker_version is 17.07, return true
given docker_version is 17.06, return false
VagrantPlugins::ProxyConf::Action::ConfigureEnvProxy
#config_name
is expected to eq "env_proxy"
#disabled?
when config proxy is enabled
is expected to eq false
when config proxy is not enabled
is expected to eq true
when config proxy is empty string
is expected to eq true
when target config proxy is enabled
given config.proxy.enabled is a Hash
when has key :enabled => true and not skipped, #disabled? should return false
when key :enabled => true and skipped => true, #disabled should return false
when config.proxy.enabled[:env] = true, return false
given config.proxy.enabled is a Boolean
when true, #disabled? should return false
when false, #disabled? should return true
when target config proxy target is not enabled
is expected to eq true
when other config proxy are not enabled
is expected to eq false
#unconfigure_machine
when proxy is not enabled
and guest is windows
should raise NotImplementedError
and guest is linux
should remove file /etc/sudoers.d/proxy, /etc/sudoers.d/proxy.sh and remove configuration from /etc/environment and return true
VagrantPlugins::ProxyConf::Action::ConfigureGitProxy
#config_name
is expected to eq "git_proxy"
#configure_machine
when configuration is enabled
when supported
configures git proxy and returns true
when not supported
does not configure the git proxy and returns nil
#unconfigure_machine
when not supported
returns nil
when supported and configuration is disabled
configures git proxy and returns true
VagrantPlugins::ProxyConf::Action::ConfigureNpmProxy
#config_name
is expected to eq "npm_proxy"
#set_or_delete_proxy
when not supported
return nil
when supported
and has value argument
should set npm config item
and does not have value argument
should delete npm config item
VagrantPlugins::ProxyConf::Action::ConfigurePearProxy
#config_name
is expected to eq "pear_proxy"
#configure_machine
when not supported
returns nil
when supported
and not disabled, sets http proxy to http://proxy:8080
and disabled, disables the proxy
#unconfigure_machine
when not supported
returns nil
when supported
disables http proxy
VagrantPlugins::ProxyConf::Action::ConfigureSvnProxy
#config_name
is expected to eq "svn_proxy"
#configure_machine
returns nil, when not supported
returns true, when supported
#unconfigure_machine
returns nil, when not supported
returns true, when supported
#svn_config
with `false`
is expected to eq "[global]\nhttp-proxy-host=\nhttp-proxy-port=\nhttp-proxy-username=\nhttp-proxy-password=\nhttp-proxy-exceptions=\n"
without userinfo
is expected to eq "[global]\nhttp-proxy-host=proxy\nhttp-proxy-port=1234\nhttp-proxy-username=\nhttp-proxy-password=\nhttp-proxy-exceptions=\n"
with userinfo
is expected to eq "[global]\nhttp-proxy-host=myproxy\nhttp-proxy-port=9876\nhttp-proxy-username=foo\nhttp-proxy-password=bar\nhttp-proxy-exceptions=\n"
with special characters
is expected to eq "[global]\nhttp-proxy-host=proxy.com\nhttp-proxy-port=8080\nhttp-proxy-username=x*y\nhttp-proxy-password=a(b\nhttp-proxy-exceptions=\n"
with URI encoded special characters
is expected to eq "[global]\nhttp-proxy-host=proxy.com\nhttp-proxy-port=8080\nhttp-proxy-username=foo%\nhttp-proxy-password=abc#123\nhttp-proxy-exceptions=\n"
VagrantPlugins::ProxyConf::Action::ConfigureYumProxy
#config_name
is expected to eq "yum_proxy"
#proxy_params
with `false`
is expected to eq "-v proxy='' -v user='' -v pass=''"
without userinfo
is expected to eq "-v proxy=http://proxy:1234 -v user='' -v pass=''"
with userinfo
is expected to eq "-v proxy=http://myproxy:9876 -v user=foo -v pass=bar"
with special characters
is expected to eq "-v proxy=http://proxy.com:8080 -v user=x\\*y -v pass=a\\(b"
with URI encoded special characters
is expected to eq "-v proxy=http://proxy.com:8080 -v user=foo\\% -v pass=abc\\#123"
#configure_machine
when not supported
returns nil
when supported
returns true
#unconfigure_machine
when not supported
returns nil
when supported
returns true
VagrantPlugins::ProxyConf::Action::IsEnabled
#has_proxy_env_var?
when HTTP_PROXY is set in the environment and config.proxy.enabled=true
is expected to eq "http://localhost:8888"
is expected to eq true
when HTTPS_PROXY= is set in the environment and config.proxy.enabled=true
is expected to eq ""
is expected to eq false
#plugin_disabled?
given config.proxy.enabled=false
is expected to eq true
given config.proxy.enabled=''
is expected to eq true
given config.proxy.enabled=nil
is expected to eq true
given config.proxy.enabled={}
is expected to eq true
given config.proxy.enabled={:foo => 'bar'}
is expected to eq false
given config.proxy.enabled=true
is expected to eq false
given config.proxy.enabled='http://localhost:8080'
is expected to eq false
#plugin_enabled?
when config.proxy.enabled=false and ENV['HTTP_PROXY']='http://localhost:8888'
is expected to eq false
#call
with `config.proxy.enabled=false`
results to falsy
with `config.proxy.enabled=""`
results to falsy
with `config.proxy.enabled={}`
results to falsy
with `config.proxy.enabled=nil`
results to falsy
with `config.proxy.enabled=true` and HTTP_PROXY=http://localhost:8888
results to truthy
with `config.proxy.enabled=:auto` and HTTP_PROXY=http://localhost:8888
results to truthy
with `config.proxy.enabled="yes please"` and HTTP_PROXY=http://localhost:8888
results to truthy
with `config.proxy.enabled={:foo=>"yes"}` and HTTP_PROXY=http://localhost:8888
results to truthy
with `config.proxy.enabled=true` and HTTP_PROXY=''
results to truthy
with `config.proxy.enabled=:auto` and HTTP_PROXY=''
results to truthy
with `config.proxy.enabled="yes please"` and HTTP_PROXY=''
results to truthy
with `config.proxy.enabled={:foo=>"yes"}` and HTTP_PROXY=''
results to truthy
VagrantPlugins::ProxyConf::Action::OnlyOnce
runs the stack first time
passes environment to the stack
updates the original environment
runs the same stack only once
runs different stacks
calls the next app defore the block by default
calls the next app after the block if specified
calls the recover method for the sequence in an error
VagrantPlugins::ProxyConf::Cap::Debian::AptProxyConf
.apt_proxy_conf
is expected to eq "/etc/apt/apt.conf.d/01proxy"
VagrantPlugins::ProxyConf::Cap::Linux::DockerProxyConf
.docker_proxy_conf
returns the path when docker is installed on Redhat
returns the path when docker is installed on Debian or Ubuntu
returns the path when docker.io is installed on Ubuntu 14.04 or higher
returns the path when docker is installed on boot2docker
returns false when docker is not installed
VagrantPlugins::ProxyConf::Cap::Linux::EnvProxyConf
.env_proxy_conf
is expected to eq "/etc/profile.d/proxy.sh"
VagrantPlugins::ProxyConf::Cap::Linux::GitProxyConf
.git_proxy_conf
returns the path when git is installed
returns false when git is not installed
VagrantPlugins::ProxyConf::Cap::Linux::NpmProxyConf
.npm_proxy_conf
returns the path when npm is installed
returns false when npm is not installed
VagrantPlugins::ProxyConf::Cap::Linux::PearProxyConf
.pear_proxy_conf
returns the path when pear is installed
returns false when pear is not installed
VagrantPlugins::ProxyConf::Cap::Linux::SvnProxyConf
.svn_proxy_conf
returns true when svn is installed
returns false when pear is not installed
VagrantPlugins::ProxyConf::Cap::Redhat::YumProxyConf
.yum_proxy_conf
is expected to eq "/etc/yum.conf"
VagrantPlugins::ProxyConf::Cap::Util
.which
returns the path when the command is installed
returns false when the command is not installed
VagrantPlugins::ProxyConf::Cap::Windows::EnvProxyConf
.env_proxy_conf
is expected to eq "/proxy.conf"
VagrantPlugins::ProxyConf::Config::AptProxy
defaults
enabled?
is expected to be falsey
to_s
is expected to eq ""
http proxy
with ip
enabled?
DEPRECATION: Specifying the scheme (http://) for `apt_proxy` URIs
will be mandatory in v2.0.0.
DEPRECATION: Please specify the port (3142) for `apt_proxy` URIs,
as the default will change in v2.0.0.
is expected to be truthy
to_s
is expected to eq "Acquire::http::Proxy \"http://10.1.2.3:3142\";\n"
with name
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::http::Proxy \"http://proxy.example.com:3142\";\n"
with name and port
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::http::Proxy \"http://acng:8080\";\n"
with protocol and name
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::http::Proxy \"http://proxy.foo.tld\";\n"
with trailing slash
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::http::Proxy \"http://proxy.foo.tld/\";\n"
with protocol and name and port
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::http::Proxy \"http://prism.nsa.gov:666\";\n"
with "DIRECT"
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::http::Proxy \"DIRECT\";\n"
with "direct"
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::http::Proxy \"DIRECT\";\n"
with :verify_peer
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::https::Verify-Peer \"false\";\n"
with :verify_host
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::https::Verify-Host \"false\";\n"
with false
enabled?
is expected to be truthy
to_s
is expected to eq ""
with ""
enabled?
is expected to be truthy
to_s
is expected to eq ""
with nil
enabled?
is expected to be falsey
to_s
is expected to eq ""
https proxy
with ip
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::https::Proxy \"https://10.1.2.3:3142\";\n"
with name
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::https::Proxy \"https://proxy.example.com:3142\";\n"
with name and port
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::https::Proxy \"https://acng:8080\";\n"
with protocol and name
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::https::Proxy \"https://proxy.foo.tld\";\n"
with trailing slash
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::https::Proxy \"https://proxy.foo.tld/\";\n"
with protocol and name and port
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::https::Proxy \"https://prism.nsa.gov:666\";\n"
with "DIRECT"
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::https::Proxy \"DIRECT\";\n"
with "direct"
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::https::Proxy \"DIRECT\";\n"
with :verify_peer
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::https::Verify-Peer \"false\";\n"
with :verify_host
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::https::Verify-Host \"false\";\n"
with false
enabled?
is expected to be truthy
to_s
is expected to eq ""
with ""
enabled?
is expected to be truthy
to_s
is expected to eq ""
with nil
enabled?
is expected to be falsey
to_s
is expected to eq ""
ftp proxy
with ip
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::ftp::Proxy \"ftp://10.1.2.3:3142\";\n"
with name
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::ftp::Proxy \"ftp://proxy.example.com:3142\";\n"
with name and port
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::ftp::Proxy \"ftp://acng:8080\";\n"
with protocol and name
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::ftp::Proxy \"ftp://proxy.foo.tld\";\n"
with trailing slash
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::ftp::Proxy \"ftp://proxy.foo.tld/\";\n"
with protocol and name and port
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::ftp::Proxy \"ftp://prism.nsa.gov:666\";\n"
with "DIRECT"
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::ftp::Proxy \"DIRECT\";\n"
with "direct"
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::ftp::Proxy \"DIRECT\";\n"
with :verify_peer
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::https::Verify-Peer \"false\";\n"
with :verify_host
enabled?
is expected to be truthy
to_s
is expected to eq "Acquire::https::Verify-Host \"false\";\n"
with false
enabled?
is expected to be truthy
to_s
is expected to eq ""
with ""
enabled?
is expected to be truthy
to_s
is expected to eq ""
with nil
enabled?
is expected to be falsey
to_s
is expected to eq ""
with both http and https proxies
enabled?
is expected to be truthy
to_s
is expected to match "^Acquire::http::Proxy\\ \"http://10\\.2\\.3\\.4:3142\";\\n"
to_s
is expected to match "^Acquire::https::Proxy\\ \"https://ssl\\-proxy:8443\";\\n"
with env var
VAGRANT_APT_HTTP_PROXY
sets http proxy
does not set other proxies
sets empty configuration
sets direct configuration
VAGRANT_APT_HTTPS_PROXY
sets https proxy
does not set other proxies
sets empty configuration
sets direct configuration
VAGRANT_APT_FTP_PROXY
sets ftp proxy
does not set other proxies
sets empty configuration
sets direct configuration
VagrantPlugins::ProxyConf::Config::EnvProxy
defaults
enabled?
is expected to be falsey
to_s
is expected to eq ""
with http config
enabled?
is expected to be truthy
to_s
is expected to match lines "export HTTP_PROXY=http://proxy.example.com:8888\n" and "export http_proxy=http://proxy.example.com:8888\n"
with http and no_proxy config
enabled?
is expected to be truthy
to_s
is expected to match lines "export HTTP_PROXY=http://proxy.example.com:8888\n", "export http_proxy=http://proxy.example.com:8888\n", "export NO_PROXY=\"localhost, 127.0.0.1\"\n", and "export no_proxy=\"localhost, 127.0.0.1\"\n"
with VAGRANT_ENV_HTTP_PROXY env var
enabled?
is expected to be truthy
to_s
is expected to match lines "export HTTP_PROXY=http://proxy.example.com:8888\n" and "export http_proxy=http://proxy.example.com:8888\n"
VagrantPlugins::ProxyConf::Config::KeyMixin
#merge_defaults
with no configuration
is expected to be a kind of TestConfig
is expected not to equal #<TestConfig:0x00007fdb56882c58 @foo=nil, @bar=nil>
foo
is expected to be nil
bar
is expected to be nil
without default configuration
foo
is expected to eq "tricky"
bar
is expected to eq "tracks"
with default configuration
foo
is expected to eq "tricky"
bar
is expected to eq "tracks"
with a mixture configuration
foo
is expected to eq "billy"
bar
is expected to eq "tracks"
with only default configuration
foo
is expected to eq "billy"
bar
is expected to be nil
VagrantPlugins::ProxyConf::Config::Key
.new
without options
name
is expected to eq :mykey
default
is expected to be nil
env_var
is expected to be nil
with string name
name
is expected to eq :mykey
with default value
default
is expected to eq "bar"
with env_var
env_var
is expected to eq "baz"
#value_from_env_var
without env_var
with a specified default
returns :default without block
yields with the :default value
returns the value from the block
and without default
returns :default without block
yields with the :default value
returns the value from the block
with env_var
returns value of the environment variable
does not yield
VagrantPlugins::ProxyConf
.logger
is expected to be a kind of Log4r::Logger
always returns the same instance
VagrantPlugins::ProxyConf::Plugin
.check_vagrant_version
accepts single String argument
accepts an Array argument
accepts multiple arguments
.check_vagrant_version!
on too old Vagrant version
raises
warns
on exact required Vagrant version
does not raise
on newer Vagrant version
does not raise
.load_optional_dependency
loads the specified plugin
ignores errors
.load_optional_dependencies
loads the plugins in alphabetical order
VagrantPlugins::ProxyConf
.resource
returns path to the specified file
resources/yum_config.awk
with empty old conf
adds the specified proxy
adds proxy and userinfo
adds disabled proxy if proxy not specified
with only main section
adds the specified proxy
adds disabled proxy if proxy not specified
with main and repository sections
without old proxy conf
adds the specified proxy
adds disabled proxy if proxy not specified
with old proxy conf
replaces existing proxy
disables existing proxy
with old proxy conf containing special characters
replaces existing proxy and userinfo
disables existing proxy
without userinfo
replaces existing proxy and adds userinfo
VagrantPlugins::ProxyConf::UserinfoURI
with nil
to_s
is expected to be nil
uri
is expected to be nil
host
is expected to be nil
port
is expected to be nil
user
is expected to be nil
pass
is expected to be nil
with false
to_s
is expected to be nil
uri
is expected to be nil
host
is expected to be nil
port
is expected to be nil
user
is expected to be nil
pass
is expected to be nil
with empty
to_s
is expected to eq ""
uri
is expected to eq ""
host
is expected to be nil
port
is expected to be nil
user
is expected to be nil
pass
is expected to be nil
without userinfo
to_s
is expected to eq "http://proxy.example.com:8123"
uri
is expected to eq "http://proxy.example.com:8123"
host
is expected to eq "proxy.example.com"
port
is expected to eq 8123
user
is expected to be nil
pass
is expected to be nil
with username
to_s
is expected to eq "http://proxy.example.com:8123"
uri
is expected to eq "http://proxy.example.com:8123"
host
is expected to eq "proxy.example.com"
port
is expected to eq 8123
user
is expected to eq "foo"
pass
is expected to be nil
with password
to_s
is expected to eq "http://proxy.example.com:8123"
uri
is expected to eq "http://proxy.example.com:8123"
host
is expected to eq "proxy.example.com"
port
is expected to eq 8123
user
is expected to eq ""
pass
is expected to eq "bar"
with userinfo
to_s
is expected to eq "http://proxy.example.com:8123"
uri
is expected to eq "http://proxy.example.com:8123"
host
is expected to eq "proxy.example.com"
port
is expected to eq 8123
user
is expected to eq "foo"
pass
is expected to eq "bar"
without port
to_s
is expected to eq "http://proxy.example.com:80"
uri
is expected to eq "http://proxy.example.com:80"
host
is expected to eq "proxy.example.com"
port
is expected to eq 80
user
is expected to eq "foo"
pass
is expected to eq "bar"
with default port
to_s
is expected to eq "http://proxy.example.com:80"
uri
is expected to eq "http://proxy.example.com:80"
host
is expected to eq "proxy.example.com"
port
is expected to eq 80
user
is expected to be nil
pass
is expected to be nil
with uri_encoded
to_s
is expected to eq "http://proxy.example.com:8123"
uri
is expected to eq "http://proxy.example.com:8123"
host
is expected to eq "proxy.example.com"
port
is expected to eq 8123
user
is expected to eq "foo%"
pass
is expected to eq "bar#123"
Finished in 0.68019 seconds (files took 0.83352 seconds to load)
362 examples, 0 failures
And here's my semi-automated acceptance tests:
$ be vagrant provision
HTTP_PROXY = 'http://10.0.2.2:8888'
HTTPS_PROXY = 'http://10.0.2.2:8888'
NO_PROXY = 'localhost'
is vagrant-proxyconf installed? true
You appear to be running Vagrant outside of the official installers.
Note that the installers are what ensure that Vagrant has all required
dependencies, and Vagrant assumes that these dependencies exist. By
running outside of the installer environment, Vagrant may not function
properly. To remove this warning, install Vagrant using one of the
official packages from vagrantup.com.
==> default: Skipping configuration of apt_proxy
==> default: Skipping configuration of chef_proxy
==> default: Skipping configuration of docker_proxy
==> default: Skipping configuration of env_proxy
==> default: Skipping configuration of git_proxy
==> default: Skipping configuration of npm_proxy
==> default: Skipping configuration of pear_proxy
==> default: Skipping configuration of svn_proxy
==> default: Skipping configuration of yum_proxy
==> docker_host: Configuring proxy for Apt...
==> docker_host: Configuring proxy for Docker...
==> docker_host: Configuring proxy environment variables...
==> docker_host: Configuring proxy for Git...
==> docker_host: Running provisioner: shell...
docker_host: Running: /var/folders/nz/lrbfwtys3hn_sgy5fn8lc7cr0000gn/T/vagrant-shell20201122-4636-630wom.iptables
docker_host: + iptables -F OUTPUT
docker_host: + iptables -Z OUTPUT
docker_host: + iptables -A OUTPUT -d 10.0.2.2 -p tcp -m tcp --dport 8888 -j ACCEPT
docker_host: + iptables -A OUTPUT -p tcp -m tcp --sport 22 -j ACCEPT
docker_host: + iptables -A OUTPUT -p udp -m udp --dport 53 -j ACCEPT
docker_host: + iptables -A OUTPUT -p udp -m udp --dport 123 -j ACCEPT
docker_host: + iptables -A OUTPUT -j LOG --log-prefix 'OUTPUT:DROPPED '
docker_host: + iptables -P OUTPUT DROP
==> docker_host: Configuring proxy for Docker...
==> docker_host: Configuring proxy for Git...
==> docker_host: Running provisioner: docker...
==> docker_host: Configuring proxy for Docker...
==> docker_host: Configuring proxy for Git...
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.6 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
$ cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
HTTP_PROXY="http://10.0.2.2:8888"
http_proxy="http://10.0.2.2:8888"
HTTPS_PROXY="http://10.0.2.2:8888"
https_proxy="http://10.0.2.2:8888"
NO_PROXY="localhost"
no_proxy="localhost"
$ cat /etc/default/docker
# Docker Upstart and SysVinit configuration file
#
# THIS FILE DOES NOT APPLY TO SYSTEMD
#
# Please see the documentation for "systemd drop-ins":
# https://docs.docker.com/engine/admin/systemd/
#
# Customize location of Docker binary (especially for development testing).
#DOCKERD="/usr/local/bin/dockerd"
# Use DOCKER_OPTS to modify the daemon startup options.
#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/"
# This is also a handy place to tweak where Docker's temporary files go.
#export DOCKER_TMPDIR="/mnt/bigdrive/docker-tmp"
HTTP_PROXY="http://10.0.2.2:8888"
http_proxy="http://10.0.2.2:8888"
HTTPS_PROXY="http://10.0.2.2:8888"
https_proxy="http://10.0.2.2:8888"
NO_PROXY="localhost"
no_proxy="localhost"
$ id
uid=1000(vagrant) gid=1000(vagrant)
groups=1000(vagrant),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),110(lxd),115(lpadmin),116(sambashare),998(docker)
$ docker info
Client:
Debug Mode: false
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 19.03.13
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 8fba4e9a7d01810a393d5d25a3621dc101981175
runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.4.0-184-generic
Operating System: Ubuntu 16.04.6 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 992.1MiB
Name: vagrant
ID: FQTY:7K2E:JIDE:X3DH:UAH2:DK7B:H2AY:7A3L:TKDU:6KUB:JEHD:6YNV
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http://10.0.2.2:8888
HTTPS Proxy: http://10.0.2.2:8888
No Proxy: localhost
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
$ git config -l
http.proxy=http://10.0.2.2:8888
https.proxy=http://10.0.2.2:8888
I'm re-opening this issue since GH decided to close it when I merged the linked PR. Please confirm this is working for you after upgrading to Vagrant 2.2.14 and ensuring you are running 2.0.10
of this plugin.
I can confirm, that this plugin (2.0.10) works with the latest vagrant. I tested the virtualbox as well as the libvirt provider.
This is excellent news @philippgl.
I'm curious if you might consider helping Chuck and I on this going forward? I feel like we could use some good help and since you've gone above and beyond I'd like to see if you are interested in helping us maintain and help us design this plugin going forward?
My only ask is if you join is to remain somewhat active in the future of this plugin and can help with issues as needed and can contribute to code reviews and feature discussions every now and again. Think about it and let us know if you are interested? If so, i'll send you an invite to our slack channel as well. We are just getting started on recruiting and defining features.
Hello @codylane , I think, I have to decline. I have no experience with ruby and I hope, that my company gets rid of their proxy soon (And then I would not even use this plugin anymore). I also do not feel like I have gone above and beyond at all. More like you have written and maintain this great plugin for us and this was more like, what I felt, I should have done as a software developer and user of open source software.
I will also close this now, because I think this was not a bug in vagrant-proxyconf, but rather the upstream bug mentioned above.
I tested this with virtualbox and libvirt providers and the following Vagrantfile:
After upgrading to Vagrant 2.2.13, it stopped working.
E.g. http_proxy does not show up in the env anymore.
I would also expect the line
on
vagrant up
.I am using Arch linux.