tmatilai / vagrant-proxyconf

Vagrant plugin that configures the virtual machine to use proxies
MIT License
531 stars 74 forks source link

Error after - vagrant login #135

Closed mskadu closed 9 years ago

mskadu commented 9 years ago

I am going through the demo and use you excellent plugin for working with my company's proxy. I am hitting an error when I use the "vagrant login" command. The other usual commands like up, halt, reload, etc seem to work without a hitch.

Here's my Vagrantfile:

Vagrant.configure(2) do |config|
  #vagrant-proxyconf settings
  if Vagrant.has_plugin?("vagrant-proxyconf")
    config.proxy.http     = "http://XX.Y.ZZ.80:9090/"
    config.proxy.https    = "http://XX.Y.ZZ.80:9090/"
    config.proxy.no_proxy = "localhost,127.0.0.1,.mycompany.com"
  end

  config.vm.box = "hashicorp/precise32"
  config.vm.provision :shell, path: "bootstrap.sh"
  config.vm.network :forwarded_port, guest:80, host:4567
end

and here's what the error looks like:

> D:\Work\vagrant\vagrant_demo>vagrant login
> In a moment we will ask for your username and password to HashiCorp's
> Atlas. After authenticating, we will store an access token locally on
> disk. Your login details will be transmitted over a secure connection, and
> are never stored on disk locally.

> If you do not have an Atlas account, sign up at
> https://atlas.hashicorp.com.
> Atlas Username: my_username
> Password (will be hidden):
> proxyconf...
> vagrant-proxyconf plugin installed, looking for proxies...
> http_proxy found, setting for VM
> https_proxy found, setting for VM
> C:/Vagrant/embedded/lib/ruby/2.0.0/uri/common.rb:176:in `split': bad URI(is not URI?): > XX.Y.ZZ.80:9090 (URI::InvalidURIError)
>        from C:/Vagrant/embedded/lib/ruby/2.0.0/uri/common.rb:211:in `parse'
>        from C:/Vagrant/embedded/lib/ruby/2.0.0/uri/common.rb:747:in `parse'
>        from C:/Vagrant/embedded/lib/ruby/2.0.0/uri/generic.rb:1672:in `find_proxy'
>        from C:/Vagrant/embedded/lib/ruby/2.0.0/net/http.rb:1032:in `proxy_uri'
>        from C:/Vagrant/embedded/lib/ruby/2.0.0/net/http.rb:1017:in `proxy?'
>        from C:/Vagrant/embedded/lib/ruby/2.0.0/net/http.rb:868:in `connect'
>        from C:/Vagrant/embedded/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
>        from C:/Vagrant/embedded/lib/ruby/2.0.0/net/http.rb:851:in `start'
>        from C:/Vagrant/embedded/gems/gems/rest-client-1.6.9/lib/restclient/request.rb:206:in `transmit'
>        from C:/Vagrant/embedded/gems/gems/rest-client-1.6.9/lib/restclient/request.rb:68:in  `execute'
>        from C:/Vagrant/embedded/gems/gems/rest-client-1.6.9/lib/restclient/request.rb:35:in `execute'
>        from C:/Vagrant/embedded/gems/gems/rest-client-1.6.9/lib/restclient.rb:74:in `post'
>        from C:/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/commands/login/client.rb:48:in `block in login'
>        from C:/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/commands/login/client.rb:92:in `with_error_handling'
>        from C:/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/commands/login/client.rb:45:in `login'
>        from C:/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/commands/login/command.rb:61:in `execute'
>        from C:/Vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/cli.rb:42:in `execute'
>        from C:/Vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/environment.rb:301:in `cli'
>        from C:/Vagrant/embedded/gems/gems/vagrant-1.7.4/bin/vagrant:174:in `<main>'

I have the latest of Virtualbox and Vagrant as of the time of writing this post. Let me know if you need further details.

mskadu commented 9 years ago

I figured it looks like the code is stumbling tried to parse the contents of the proxy. so I've tried changing it to the following varieties:

http://XX.Y.ZZ.80:9090 XX.Y.ZZ.80:9090

No luck :-(

tmatilai commented 9 years ago

Hi,

vagrant-proxyconf should not even kick in with vagrant login. I assume that output comes from the closed-source vagrant-share plugin. (News to me it even tries to fetch vagrant-proxyconf settings.)

Do you have https_proxy set in your environment variables in the shell? Does it have the http:// prefix?

mskadu commented 9 years ago

I just realized I did have proxy environment variables :-( Removing them completely caused the following error

vagrant login In a moment we will ask for your username and password to HashiCorp's Atlas. After authenticating, we will store an access token locally on disk. Your login details will be transmitted over a secure connection, and are never stored on disk locally.

If you do not have an Atlas account, sign up at https://atlas.hashicorp.com. Atlas Username: my_username Password (will be hidden): proxyconf... vagrant-proxyconf plugin installed, looking for proxies... C:/Vagrant/embedded/lib/ruby/2.0.0/net/http.rb:878:in initialize': A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. - connect(2) (Errno::ETIMEDOUT) from C:/Vagrant/embedded/lib/ruby/2.0.0/net/http.rb:878:inopen' from C:/Vagrant/embedded/lib/ruby/2.0.0/net/http.rb:878:in block in connect' from C:/Vagrant/embedded/lib/ruby/2.0.0/timeout.rb:52:intimeout' from C:/Vagrant/embedded/lib/ruby/2.0.0/net/http.rb:877:in connect' from C:/Vagrant/embedded/lib/ruby/2.0.0/net/http.rb:862:indo_start' from C:/Vagrant/embedded/lib/ruby/2.0.0/net/http.rb:851:in start' from C:/Vagrant/embedded/gems/gems/rest-client-1.6.9/lib/restclient/request.rb:206:intransmit' from C:/Vagrant/embedded/gems/gems/rest-client-1.6.9/lib/restclient/request.rb:68:in execute' from C:/Vagrant/embedded/gems/gems/rest-client-1.6.9/lib/restclient/request.rb:35:inexecute' from C:/Vagrant/embedded/gems/gems/rest-client-1.6.9/lib/restclient.rb:74:in post' from C:/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/commands/login/client.rb:48:inblock in login' from C:/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/commands/login/client.rb:92:in with_error_handling' from C:/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/commands/login/client.rb:45:inlogin' from C:/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/commands/login/command.rb:61:in execute' from C:/Vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/cli.rb:42:inexecute' from C:/Vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/environment.rb:301:in cli' from C:/Vagrant/embedded/gems/gems/vagrant-1.7.4/bin/vagrant:174:in

'

But I am guessing this is vagrant telling me it can't connect to the internet.

So I guess this sorts the problem. Appreciate your quick response :)