tmatilai / vagrant-proxyconf

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

Proxy support for test-kitchen (vagrant adapter) #64

Closed jperville closed 10 years ago

jperville commented 10 years ago

Hello @tmatilai,

It took me a while to understand how to configure chef running in test-kitchen to use my proxy settings. Unlike in #21 there is no special provisioner that can be detected in config.vm.provisioners then configured.

After reading test-kitchen/kitchen-vagrant#90 and especially @esciara's comments, I ended up putting the following content in my ~/.kitchen/config.yml.


---
provisioner:
  solo_rb:
    http_proxy: http://10.0.3.84:3128
    https_proxy: http://10.0.3.84:3128
    no_proxy: localhost,127.0.0.1
  client_rb:
    http_proxy: http://10.0.3.84:3128
    https_proxy: http://10.0.3.84:3128
    no_proxy: localhost,127.0.0.1

This should work with both the chef_zero and chef_solo provisioners that are used under the hood by the vagrant adapter for test-kitchen.

It would be nice to have vagrant-proxyconf detect when it is running through kitchen-vagrant (test-kitchen's vagrant adapter) and fill these attributes automatically.

tmatilai commented 10 years ago

Hi Julien,

Bad news: As test-kitchen doesn't use Vagrant's Chef provisioners, but invokes Chef directly over SSH, #21 has no effect.

Bad news: As test-kitchen shells out to invoke Vagrant, we don't have any access to it's configuration. At the time vagrant-proxyconf kicks in, the config file has been already evaluated, so we can't even try dirty tricks for manipulating it at run time.

Good news: I'm quite sure #58 will fix this too. I'll leave this open so we remember to verify it.

johnbellone commented 10 years ago

@tmatilai I actually have this working locally.

johnbellone commented 10 years ago

I made a modification to test-kitchen in my pull request feel free to confirm it.

tmatilai commented 10 years ago

Oh, I also forgot that Chef doesn't even read http_proxy etc. environment variables, so #58 doesn't help with Chef Server API calls, remote_file resources, etc. But still it would help with the omnibus installer at least. So anyway you will need to configure test-kitchen directly until CHEF-4609 is fixed.

jperville commented 10 years ago

Thank you @johnbellone for the test-kitchen pull request, it will make my live much easier (I live in a developing country where we have 20k/s Internet... when it works). @tmatilai yes, chef does not honor http_proxy environment variables yet, so have to configure it explicitly in client.rb.

tmatilai commented 10 years ago

I'm closing this as #58 is implemented and released, and there isn't much more we can do in this plugin.

Another good news is that Chef 11.14 should finally support environment variables.

andreamaruccia commented 9 years ago

such an hard time to get this working :/ thx @jperville for the ~/.kitchen/config.yml sample