tmatilai / vagrant-proxyconf

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

Provisioning of docker fails issue 180 #182

Closed codylane closed 5 years ago

codylane commented 5 years ago

Attempt to address #180, #181

Overview of Bugfix/Features

The vagrant-proxyconf plugin is installed AND no config.proxy.* are set in a Vagrantfile

Vagrant.configure("2") do |config|
    config.vm.provider "docker" do |d|
      d.image = "hello-world"
    end
end

The pull request addresses this problem by disabling the vagrant-proxyconf plugin.

The second feature of this pull request

Adds additional logic to check if a proxy should be configured Given either of the following environment variables being set export HTTP_PROXY=http://$my_proxy_host:$my_proxy_port OR export HTTPS_PROXY=https://$my_proxy_host:$my_proxy_port AND Given this Vagrantfile

Vagrant.configure("2") do |config|

    if Vagrant.has_plugin?("vagrant-proxyconf")
      config.proxy.http      = "#{ENV['HTTP_PROXY']}"
      config.proxy.https     = "#{ENV['HTTPS_PROXY']}"
      config.proxy.no_proxy  = "#{ENV['NO_PROXY']}"
    end

    config.vm.provider "docker" do |d|
      d.image = "hello-world"
    end
end

The vagrant-proxyconf plugin would be enabled for all capable providers on the guest. However, if you didn't set HTTP_PROXY or HTTPS_PROXY in your environment before running vagrant up or vagrant provision then there is new logic to disable vagrant-proxyconf from attempting to configure your guest.

The new logic is an attempt to auto-configure the vagrant-proxyconf providers based off your current environment proxy variables.

codylane commented 5 years ago

@tmatilai - Thoughts on removing support for EOL ruby 2.2.5? I have no easy way to test the failure that travis-ci is reporting.

tmatilai commented 5 years ago

Thoughts on removing support for EOL ruby 2.2.5? I have no easy way to test the failure that travis-ci is reporting.

Oh my... Travis is a moving target. Dropping Ruby 2.2 would mean dropping also testing of Vagrant 1.8. Just recently I dropped the even older ones, so fine by me. Vagrant 1.9 was released over two years ago.

codylane commented 5 years ago

Thoughts on removing support for EOL ruby 2.2.5? I have no easy way to test the failure that travis-ci is reporting.

Oh my... Travis is a moving target. Dropping Ruby 2.2 would mean dropping also testing of Vagrant 1.8. Just recently I dropped the even older ones, so fine by me. Vagrant 1.9 was released over two years ago.

Roger, thanks for responding back. I plan to remove 2.2.5 from .travis.yml sometime this weekend.

codylane commented 5 years ago

There is one minor use case in this pull request that I forgot to address.

Scenario

When disabling this plugin config.proxy.enabled = false for any proxies have been configured in the guest environment there is a still a problem that disabling the proxy doesn't "undo" any configuration that has been applied, instead it skips the provider from being configured. The user has to remember to also set the provide specific skip option to true, which is really confusing.

This is the default

{
  :apt    => {
    :enabled => true,
    :skip    => true,
  },
  :chef => {
    :enabled => true,
    :skip    => true,
  },
  :docker => {
    :enabled => true,
    :skip    => true
  },
  :env => {
    :enabled => true,
    :skip    => true,
  },
  :git => {
    :enabled => true,
    :skip    => true,
  },
  :npm => {
    :enabled => true,
    :skip    => true,
  },
  :pear => {
    :enabled => true,
    :skip    => true
  },
  :svn => {
    :enabled => true,
    :skip    => true,
  },
  :yum => {
    :enabled => true,
    :skip    => true,
  },
}

We need to think about how to set those skip options for the user when the user wants to disable the proxy for all providers