Setup
I face some strange problems with chef test-kitchen. I use a very basic case, where I try to install and run Apache on 2 platforms.
driver:
name: vagrant
provisioner:
name: chef_zero
always_update_cookbooks: true
verifier:
name: inspec
platforms:
- name: centos-6.7
- name: ubuntu-16.04
suites:
- name: default
run_list:
- recipe[httpd::default]
verifier:
inspec_tests:
- test/smoke/default
attributes:
The reccipe (attributes) detects the platform for the package installation:
case node['platform']
when 'ubuntu'
default['httpd']['package_name'] = 'apache2'
else
default['httpd']['package_name'] = 'httpd'
end
The installation itself is based on the default action: package node['httpd']['package_name']
Kitchen execution
kitchen test
works fine for CentOS.
But on Ubuntu I get an error during the kitchen converge
phase:
-- Begin output of ["apt-get", "-q", "-y", "install", "apache2=2.4.18-2ubuntu3.3"] ----
STDOUT: Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
apache2-bin apache2-data apache2-utils libapr1 libapru til1
libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 ssl-cert
Suggested packages:
www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom
openssl-blacklist
The following NEW packages will be installed:
apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 ssl-cert
0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Need to get 1560 kB of archives.
After this operation, 6432 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libapr1 amd64 1.5.2-3 [86.0 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1 amd64 1.5.4-1build1 [77.1 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1-dbd-sqlite3 amd64 1.5.4-1build1 [10.6 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1-ldap amd64 1.5.4-1build1 [8720 B]
Get:5 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 liblua5.1-0 amd64 5.1.5-8ubuntu1 [102 kB]
...
When I check the us.archive.ubuntu.com website, I can not find the requested binaries. So it's logical that the installation fails. I don't really know where the apache2=2.4.18-2ubuntu3.3
is defined. Does someone know that? Anybody faced similar issues?
Thank you very much. Cheers, Thomas
You probably need an apt-get update
because your apt cache files in the image are out of date. We have the apt_update
resource to handle this for you.