Kitchen测试失败:Sudo需要密码,请在default-centos-67上配置
Kitchen test failed: Sudo requires a password, please configure it on default-centos-67
这是我的食谱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
我执行了 kitchen test 命令并得到了这个错误。
>>>>>> ------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 需要密码但不幸的是它不起作用。
我通过更新 kitchen.yml
中的 attributes
修复了它。
attributes:
authorization:
sudo:
users: ['kitchen']
passwordless: true
include_sudoers_d: true
这通常意味着在您正在测试的食谱中的某处,您正在更改 sudoers 配置,以便 kitchen
用户没有 nopasswd sudo。您需要要么不这样做,要么在 Test Kitchen 下 运行 时确保为 kitchen
用户重新创建条目。
这是我的食谱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
我执行了 kitchen test 命令并得到了这个错误。
>>>>>> ------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 需要密码但不幸的是它不起作用。
我通过更新 kitchen.yml
中的 attributes
修复了它。
attributes:
authorization:
sudo:
users: ['kitchen']
passwordless: true
include_sudoers_d: true
这通常意味着在您正在测试的食谱中的某处,您正在更改 sudoers 配置,以便 kitchen
用户没有 nopasswd sudo。您需要要么不这样做,要么在 Test Kitchen 下 运行 时确保为 kitchen
用户重新创建条目。