设置
我在厨师测试厨房面临一些奇怪的问题。我使用了一个非常基本的案例,我尝试在2个平台上安装和运行Apache。
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:
reccipe(属性)检测到软件包安装的平台:
case node['platform']
when 'ubuntu'
default['httpd']['package_name'] = 'apache2'
else
default['httpd']['package_name'] = 'httpd'
end
安装本身基于默认操作: 包节点['httpd'] ['package_name']
厨房执行
kitchen test
适用于CentOS。
但是在Ubuntu上我在kitchen converge
阶段遇到错误:
-- 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]
...
当我查看us.archive.ubuntu.com网站时,我找不到请求的二进制文件。因此,安装失败是合乎逻辑的。我真的不知道apache2=2.4.18-2ubuntu3.3
的定义在哪里。有人知道吗?有人遇到类似的问题吗?
非常感谢你。 干杯,托马斯
答案 0 :(得分:2)
您可能需要apt-get update
,因为图片中的apt缓存文件已过期。我们有apt_update
资源来为您处理此问题。