[RESOLVED] Cannot use kitchen under proxy

Hello,
I'm starting now with chef and following the tutorial I'd already cooked my first recipes :).

I'd also used kitchen, but then I've tried to use kitchen at work(and we're under proxy :confused: )

It seems that the problem is the vagrant file automatically generated when I'm launching the command kitchen create. I know that for using proxy with vagrant I need to set some entries (and in other project without chef there's no problem)

this the output of the command kitchen create:

> gdm:learn_chef_httpd gi.dimaria$ kitchen create
> -----> Starting Kitchen (v1.14.2)
> -----> Creating <default-centos-72>...
>        Bringing machine 'default' up with 'virtualbox' provider...
>        ==> default: Checking if box 'bento/centos-7.2' is up to date...
>        ==> default: Clearing any previously set forwarded ports...
>        ==> default: Clearing any previously set network interfaces...
>        ==> default: Preparing network interfaces based on configuration...
>            default: Adapter 1: nat
>        ==> default: Forwarding ports...
>            default: 22 (guest) => 2222 (host) (adapter 1)
>        ==> default: Booting VM...
>        ==> default: Waiting for machine to boot. This may take a few minutes...
>            default: SSH address: 127.0.0.1:2222
>            default: SSH username: vagrant
>            default: SSH auth method: private key
>        Timed out while waiting for the machine to boot. This means that
>        Vagrant was unable to communicate with the guest machine within
>        the configured ("config.vm.boot_timeout" value) time period.
>        
>        If you look above, you should be able to see the error(s) that
>        Vagrant had when attempting to connect to the machine. These errors
>        are usually good hints as to what may be wrong.
>        
>        If you're using a custom box, make sure that networking is properly
>        working and you're able to connect to the machine. It is a common
>        problem that networking isn't setup properly in these boxes.
>        Verify that authentication configurations are also setup properly,
>        as well.
>        
>        If the box appears to be booting properly, you may want to increase
>        the timeout ("config.vm.boot_timeout") value.

and this is the my .kitchen.yml:

driver:
name: vagrant
provisioner:
name: chef_zero
http_proxy: http://myproxy.it:8080

verifier:
name: inspec

platforms:

  • name: centos-7.2

suites:

  • name: default
    run_list:
    • recipe[learn_chef_httpd::default]
      attributes:

I need to use kitchen under proxy but I don't know how to set correctly this file.
can you help me please?

in my shell the proxy variables are already set

Giuseppe

you may need to set a no_proxy env var as well.
no_proxy: "localhost,127.0.0.1,*.local,*.yourdomain.com"

I see you are using bento/centos-7.2 and might be having the same issue I ran into last week. After tons of searching it turns out I needed to set cableconnected as on.

driver:
name: vagrant
customize:
cableconnected1: 'on'

thank you.
the no_proxy was already set on my .bash_profile

so the new files should be:

driver:
name: vagrant
customize:
cableconnected1: 'on'
provisioner:
name: chef_zero
http_proxy: http://myproxy.it:8080

verifier:
name: inspec

platforms:
- name: centos-7.2

suites:
- name: default
run_list:
- recipe[learn_chef_httpd::default]
attributes:

right?

You need to set timeout variable in vagrant file with higher value, I think
the default value will be around 300, increase it to 1200 and see…

looks good to me.

@giuseppestorm Can you please try with centos-7.1…I think there is a issue with centos-7.2 Box.

https://github.com/nsidc/vagrant-vsphere/issues/182

We use this extensively. Assuming I can dig out of my hotel and get to the office I’ll provide our config. You can hit me up on Chef Community Slack if I forget :).

JB

Hello,
I’ve resolved the issue but the problem was my conf file in .ssh. Infact, even the knife command given a problem for ssh connection.

after having disabled the conf file I could use kitchen and knife.

sorry I don’t understand :slight_smile:

Hi,

We had similar issues and it turned out that the system environment variable no_proxy has a slightly different syntax than the ruby setting. While the system needs wildcards like *.localdomain, ruby does not need/allow that. Even worse, it seems that if the environment variable is set the specific ruby setting is overridden by it.
So we had to unset all proxy related environment variables and set them in our knife.rb:

http_proxy                "http://proxy.local:57165"
https_proxy               "http://proxy.local:57165"
no_proxy                  "domain.com,domain.corp,localhost,127.0.0.1"

the problem is solved.
After commenting the ssh config on my host I can use correctly kitchen.

thanks of all :slight_smile:
Giuseppe