Kitchen-converge keep's trying to install chef omnibus

Hi,
I was trying to set up vagrant using test-kitchen and I am behind a proxy server. I have installed vagrant-proxyconf gem along with test-kitchen,kitchen-vagrant and berkshelf. I do have configured proxyconfig parameters in the vagrantfile present in cookbook.

I observe the virtualmachine displayed in virtualbox but kitchen-converge doesn’t proceed and keeps trying to wget to install omnibus. Please let me know what i should look for to be able to continue with chef-client.

Vagrantfile:

if Vagrant.has_plugin?(“vagrant-proxyconf”)
config.proxy.http = "http://proxy.abc.testserver.com:8099"
config.proxy.https = "https://proxy.abc.testserver.com:8099"
config.proxy.no_proxy = "localhost,127.0.0.1"
end

kitchen.yml:

driver:
name: vagrant
customize:
natdnshostresolver1: "on"
network:

  • [“forwarded_port”, { guest: 81, host: 8082 }]
  • [“forwarded_port”, { guest: 80, host: 8087 }]
    provisioner:
    chef_omnibus_url: http://www.chef.io/chef/install.sh
    name: chef_zero

platforms:

  • name: centos-6.7
    suites:
  • name: default
    run_list:
  • recipe[chef-boxtest::default]
    attributes:

Logs:

$vagrant box list
opscode-centos-6.7 (virtualbox, 0)

chef-boxtest$ kitchen converge
-----> Starting Kitchen (v1.6.0)
-----> Creating …
Bringing machine ‘default’ up with ‘virtualbox’ provider…
==> default: Importing base box ‘opscode-centos-6.7’…
==> default: Matching MAC address for NAT networking…
==> default: Setting the name of the VM: kitchen-chef-boxtest-default-centos-67_default_1459189758458_24529
==> default: Clearing any previously set network interfaces…
==> default: Preparing network interfaces based on configuration…
default: Adapter 1: nat
==> default: Forwarding ports…
default: 81 (guest) => 8082 (host) (adapter 1)
default: 80 (guest) => 8087 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running ‘pre-boot’ VM customizations…
==> 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
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest…
default: Removing insecure key from the guest if it’s present…
default: Key inserted! Disconnecting and reconnecting using new SSH key…
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM…
==> default: Setting hostname…
==> default: Machine not provisioned because --no-provision is specified.
[SSH] Established
Vagrant instance created.
Finished creating (0m41.05s).
-----> Converging …
Preparing files for transfer
Preparing dna.json
Resolving cookbook dependencies with Berkshelf 4.3.1…
Removing non-cookbook files before transfer
Preparing validation.pem
Preparing client.rb
-----> Installing Chef Omnibus (install only if missing)
Downloading http://www.chef.io/chef/install.sh to file /tmp/install.sh
Trying wget…

Does it continue to run after that point? i would think its just checking for a newer version every run (maybe using latest? or even a version specified… might just check whats installed vs what is downloaded

I dont think it’s a show stopper unless you case is completely different

It doesn’t run after that point.I am not completely sure where i could check the installed vs download version. But, here’s my try…i am novice to chef and trying to learn things as am writing a cook book.

$ls -lh which chef
lrwxr-xr-x 1 root admin 20B Mar 22 21:31 /usr/local/bin/chef -> /opt/chefdk/bin/chef
Chef Development Kit Version: 0.11.2

But, when i tried to verify the chef components installed i observed, ruby gems were pointing to 2.1.0 in opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/, however, i was using ruby-2.2.3 version of ruby installed through rvm. Did i mess up anything with the way i have set up my chefdk and also my ruby environment.

$chef verify
Running verification for component 'berkshelf’
Running verification for component 'test-kitchen’
Running verification for component 'tk-policyfile-provisioner’
Running verification for component 'chef-client’
Running verification for component 'chef-dk’
Running verification for component 'chef-provisioning’
Running verification for component 'chefspec’
Running verification for component 'generated-cookbooks-pass-chefspec’
Running verification for component 'rubocop’
Running verification for component 'fauxhai’
Running verification for component 'knife-spork’
Running verification for component 'kitchen-vagrant’
Running verification for component 'package installation’
Running verification for component ‘openssl’
Running verification for component ‘inspec’
…/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/mixlib-shellout-2.2.6/lib/mixlib/shellout.rb:289:in invalid!': Expected process to exit with [0], but received '1' (Mixlib::ShellOut::ShellCommandFailed) ---- Begin output of /usr/local/bin/ohai -v ---- STDOUT: STDERR: /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:319:into_specs’: Could not find ‘chef-config’ (= 12.8.0) - did find: [chef-config-12.7.2] (Gem::LoadError)
Checked in ‘GEM_PATH=/Users/hqj030/.chefdk/gem/ruby/2.1.0:/opt/chefdk/embedded/lib/ruby/gems/2.1.0’, execute gem env for more information
from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:328:in to_spec' from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:65:ingem’
from /usr/local/bin/ohai:4:in <main>' ---- End output of /usr/local/bin/ohai -v ---- Ran /usr/local/bin/ohai -v returned 1 from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/mixlib-shellout-2.2.6/lib/mixlib/shellout.rb:276:inerror!‘
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-dk-0.11.2/lib/chef-dk/component_test.rb:99:in block in sh!' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-dk-0.11.2/lib/chef-dk/component_test.rb:99:intap’
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-dk-0.11.2/lib/chef-dk/component_test.rb:99:in sh!' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-dk-0.11.2/lib/chef-dk/command/verify.rb:358:inblock (2 levels) in class:Verify
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-dk-0.11.2/lib/chef-dk/component_test.rb:78:in instance_eval' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-dk-0.11.2/lib/chef-dk/component_test.rb:78:inrun_smoke_test’
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-dk-0.11.2/lib/chef-dk/command/verify.rb:475:in `block (2 levels) in invoke_tests’

I tried to check ohai and observed that chefdk could be missing right version of chef-config not bundled. how could i get the right version to over come this error.

ohai
/opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:319:in `to_specs’: Could not find ‘chef-config’ (= 12.8.0) - did find: [chef-config-12.7.2] (Gem::LoadError)

You might try setting the http_proxy and https_proxy provisioner config settings in your .kitchen.yml instead of using vagrant-proxyconf.

Thanks @Matt_Wrock for looking into it. I have used environment variables in my shell for the proxy settings and haven’t used in .kitchen.yml. I will use them in my config and see how it works.

@Matt_Wrock I have updated the kitchen.yml with proxy settings and tried to run kitchen test but failed with the following error which i believe is not able to find the centos base box. should i also be using any other proxy variables to work behind proxy server in my kitchen.yml or vagrant file. Thank you.
kitchen.yml


driver:
name: vagrant
customize:
natdnshostresolver1: "on"
network:

kitchen test:

I, [2016-03-30T08:29:32.083105 #90245] INFO – Kitchen: -----> Starting Kitchen (v1.6.0)
I, [2016-03-30T08:29:32.835019 #90245] INFO – Kitchen: -----> Cleaning up any prior instances of
I, [2016-03-30T08:29:32.835171 #90245] INFO – Kitchen: -----> Destroying …
I, [2016-03-30T08:29:32.840673 #90245] INFO – Kitchen: -----> Testing
I, [2016-03-30T08:29:32.840834 #90245] INFO – Kitchen: -----> Creating …
E, [2016-03-30T08:30:39.269981 #90245] ERROR – Kitchen: ------Exception-------
E, [2016-03-30T08:30:39.270112 #90245] ERROR – Kitchen: Class: Kitchen::ActionFailed
E, [2016-03-30T08:30:39.270132 #90245] ERROR – Kitchen: Message: Failed to complete #create action: [Expected process to exit with [0], but received ‘1’
---- Begin output of vagrant up --no-provision --provider virtualbox ----
STDOUT: Bringing machine ‘default’ up with ‘virtualbox’ provider…
==> default: Importing base box ‘centos/7’…
==> default: Matching MAC address for NAT networking…
==> default: Checking if box ‘centos/7’ is up to date…
==> default: Setting the name of the VM: kitchen-darknight-default-centos-7_default_1459344583118_16407
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Clearing any previously set network interfaces…
==> default: Preparing network interfaces based on configuration…
default: Adapter 1: nat
==> default: Forwarding ports…
default: 81 (guest) => 8082 (host) (adapter 1)
default: 80 (guest) => 8087 (host) (adapter 1)
default: 22 (guest) => 2200 (host) (adapter 1)
==> default: Running ‘pre-boot’ VM customizations…
==> default: Booting VM…
==> default: Waiting for machine to boot. This may take a few minutes…
default: SSH address: 127.0.0.1:2200
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Remote connection disconnect. Retrying…
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest…
default: Removing insecure key from the guest if it’s present…
default: Key inserted! Disconnecting and reconnecting using new SSH key…
==> default: Machine booted and ready!
No installation found.
Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#7 - "Failed connect to mirrorlist.centos.org:80; Operation now in progress"
One of the configured repositories failed (Unknown),
and yum doesn’t have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work “fix” this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Disable the repository, so yum won’t use it by default. Yum will then
just ignore the repository until you permanently enable it again or use
–enablerepo for temporary usage:
yum-config-manager --disable
4. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64
==> default: Checking for guest additions in VM…
default: No guest additions were detected on the base box for this VM! Guest
default: additions are required for forwarded ports, shared folders, host only
default: networking, and more. If SSH fails on this machine, please install
default: the guest additions and repackage the box to continue.
default:
default: This is not an error message; everything may continue to work properly,
default: in which case you may ignore this message.
STDERR: The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
yum install -y kernel-devel-uname -r gcc make perl bzip2
Stdout from the command:
Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#7 - "Failed connect to mirrorlist.centos.org:80; Operation now in progress"
Stderr from the command:
One of the configured repositories failed (Unknown),
and yum doesn’t have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work “fix” this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Disable the repository, so yum won’t use it by default. Yum will then
just ignore the repository until you permanently enable it again or use
–enablerepo for temporary usage:
yum-config-manager --disable
4. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64
---- End output of vagrant up --no-provision --provider virtualbox ----
Ran vagrant up --no-provision --provider virtualbox returned 1]
E, [2016-03-30T08:30:39.270160 #90245] ERROR – Kitchen: —Nested Exception—
E, [2016-03-30T08:30:39.270175 #90245] ERROR – Kitchen: Class: Kitchen::ShellOut::ShellCommandFailed
E, [2016-03-30T08:30:39.270192 #90245] ERROR – Kitchen: Message: Expected process to exit with [0], but received ‘1’
---- Begin output of vagrant up --no-provision --provider virtualbox ----
STDOUT: Bringing machine ‘default’ up with ‘virtualbox’ provider…
==> default: Importing base box ‘centos/7’…
==> default: Matching MAC address for NAT networking…
==> default: Checking if box ‘centos/7’ is up to date…
==> default: Setting the name of the VM: kitchen-darknight-default-centos-7_default_1459344583118_16407
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Clearing any previously set network interfaces…
==> default: Preparing network interfaces based on configuration…
default: Adapter 1: nat
==> default: Forwarding ports…
default: 81 (guest) => 8082 (host) (adapter 1)
default: 80 (guest) => 8087 (host) (adapter 1)
default: 22 (guest) => 2200 (host) (adapter 1)
==> default: Running ‘pre-boot’ VM customizations…
==> default: Booting VM…
==> default: Waiting for machine to boot. This may take a few minutes…
default: SSH address: 127.0.0.1:2200
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Remote connection disconnect. Retrying…
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest…
default: Removing insecure key from the guest if it’s present…
default: Key inserted! Disconnecting and reconnecting using new SSH key…
==> default: Machine booted and ready!
No installation found.
Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#7 - "Failed connect to mirrorlist.centos.org:80; Operation now in progress"
One of the configured repositories failed (Unknown),
and yum doesn’t have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work “fix” this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Disable the repository, so yum won’t use it by default. Yum will then
just ignore the repository until you permanently enable it again or use
–enablerepo for temporary usage:
yum-config-manager --disable
4. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64
==> default: Checking for guest additions in VM…
default: No guest additions were detected on the base box for this VM! Guest
default: additions are required for forwarded ports, shared folders, host only
default: networking, and more. If SSH fails on this machine, please install
default: the guest additions and repackage the box to continue.
default:
default: This is not an error message; everything may continue to work properly,
default: in which case you may ignore this message.
STDERR: The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
yum install -y kernel-devel-uname -r gcc make perl bzip2
Stdout from the command:
Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#7 - "Failed connect to mirrorlist.centos.org:80; Operation now in progress"
Stderr from the command:
One of the configured repositories failed (Unknown),
and yum doesn’t have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work “fix” this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Disable the repository, so yum won’t use it by default. Yum will then
just ignore the repository until you permanently enable it again or use
–enablerepo for temporary usage:
yum-config-manager --disable
4. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64
---- End output of vagrant up --no-provision --provider virtualbox ----
Ran vagrant up --no-provision --provider virtualbox returned 1
E, [2016-03-30T08:30:39.270216 #90245] ERROR – Kitchen: ------Backtrace-------
E, [2016-03-30T08:30:39.270232 #90245] ERROR – Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/shell_out.rb:73:in rescue in run_command' E, [2016-03-30T08:30:39.270245 #90245] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.6.0/lib/kitchen/shell_out.rb:61:inrun_command’
E, [2016-03-30T08:30:39.270299 #90245] ERROR – Kitchen: /opt/chefdk/em

The only other thing I can think of off hand is to try setting the HTTP_PROXY and HTTPS_PROXY environment variables before launching the kitchen run.