2016-09-16 2 views
0

これはdefault.rbのレシピです。台所テストに失敗しました:Sudoにパスワードが必要です。デフォルトで設定してください-centos-67

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 

私は台所のテストコマンドを実行すると、このERORを得ました。

>>>>>> ------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 

私はsudoがパスワードが必要ですが、残念ながら、それは動作しませんので、それを構成するためにkitchen.ymlを更新しました。

attributeskitchen.ymlに更新して修正しました。

attributes: 
    authorization: 
     sudo: 
      users: ['kitchen'] 
      passwordless: true 
      include_sudoers_d: true 

答えて

2

これは通常、あなたがkitchenユーザーがNOPASSWD sudoを持っていないような設定ファイル、あなたはsudoersファイルを変更しているテストしている料理のどこかを意味します。あなたはそれをしないか、Test Kitchenの下で実行しているときにkitchenユーザのエントリを再作成してください。

+0

こんにちは@coderanger、私は 'sudo'料理本の属性やsudoers設定を上書きしませんでしたが、私はそれを私の料理本に入れるときに問題があります。回答ありがとうございます。 – micmicsuarez

+0

はい、 'sudo'クックブックのデフォルト設定は物事を壊すのに十分です。 – coderanger

+0

こんにちは@coderanger、私はあなたに同意します。私は 'kitchen login'を使って仮想マシンにログインし、キッチンユーザーを追加するために' sudoers'ファイルを編集して一時的な解決策を作成しました。どうすれば修正できますか?ありがとう。 – micmicsuarez

関連する問題