这是我的食谱的default.rb食谱的内容。
include_recipe 'sudo'
include_recipe 'chef-vault'
group "#{node['cookbook']['group']}" do
action :create
append true
system false
end
user 'user' do
supports :manage_home => false
home nil
system false
password "HASH_PASSWORD"
gid "#{node['cookbook']['group']}"
shell '/bin/bash'
action :create
end这也是kitchen.yml的内容。
driver:
name: docker
use_sudo: false
provisioner:
name: chef_zero
verifier:
name: inspec
platforms:
- name: centos-6.7
suites:
- name: default
data_bags_path: "test/integration/default/data_bags"
encrypted_data_bag_secret_key_path: "test/integration/default/encrypted_data_bag_secret"
run_list:
- recipe[rise-users::default]
attributes: 这是我做的厨房测试。
control "mycookbook-1.0" do
impact 1.0
title "myCookbook users packages and configuration files"
desc "packages and configuration files that should exist on all servers"
describe user('user') do
it { should exist }
end
end我执行了厨房测试命令,得到了这个错误。
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>> Failed to complete #verify action: [Sudo failed: Sudo requires a password, please configure it.] on default-centos-67
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration我更新了kitchen.yml来配置它,因为sudo需要一个密码,但不幸的是它不能工作。
我通过更新attributes中的kitchen.yml来修正它。
attributes:
authorization:
sudo:
users: ['kitchen']
passwordless: true
include_sudoers_d: true 发布于 2016-09-16 04:47:55
这通常意味着在您正在测试的菜谱中,您正在更改sudoers配置,使kitchen用户没有nopasswd。您需要要么不这样做,要么在Test下运行时,确保为kitchen用户重新创建条目。
https://stackoverflow.com/questions/39523883
复制相似问题