首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >厨房测试失败: Sudo需要密码,请在默认情况下配置它-centos-67。

厨房测试失败: Sudo需要密码,请在默认情况下配置它-centos-67。
EN

Stack Overflow用户
提问于 2016-09-16 04:45:13
回答 1查看 2.1K关注 0票数 1

这是我的食谱的default.rb食谱的内容。

代码语言:javascript
复制
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的内容。

代码语言:javascript
复制
    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: 

这是我做的厨房测试。

代码语言:javascript
复制
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

我执行了厨房测试命令,得到了这个错误。

代码语言:javascript
复制
>>>>>> ------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来修正它。

代码语言:javascript
复制
 attributes: 
    authorization: 
        sudo: 
            users: ['kitchen'] 
            passwordless: true 
            include_sudoers_d: true 
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-09-16 04:47:55

这通常意味着在您正在测试的菜谱中,您正在更改sudoers配置,使kitchen用户没有nopasswd。您需要要么不这样做,要么在Test下运行时,确保为kitchen用户重新创建条目。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39523883

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档