2017-09-25 111 views
1

我有一本食譜設置Splunk Forwarder。我爲配置文件創建了許多集成 - serverspec測試。其中一個,特別是/opt/splunkforwarder/etc/apps/search/local/inputs.conf保持其他文件傳遞的所有測試失敗。我的代碼如下所示:serverspec在一個且只有一個文件上保持失敗

require 'spec_helper' 

describe file('/opt/splunkforwarder/etc/apps/search/local/') do 
    it { should be_directory } 
    it { should be_owned_by 'nobody' } 
    it { should be_mode 755 } 
end 

describe file('/opt/splunkforwarder/etc/system/local/') do 
    it { should be_directory } 
    it { should be_owned_by 'nobody' } 
    it { should be_mode 755 } 
end 

describe file('/opt/splunkforwarder/etc/system/local/outputs.conf') do 
    it { should exist } 
    it { should be_owned_by 'nobody' } 
    it { should be_mode 600 } 
end 

describe file('/opt/splunkforwarder/etc/system/local/inputs.conf') do 
    it { should exist } 
    it { should be_owned_by 'nobody' } 
    it { should be_mode 600 } 
end 

describe file('/opt/splunkforwarder/etc/apps/search/local/inputs.conf}') do 
    it { should exist } 
    it { should be_owned_by 'nobody' } 
    it { should be_mode 600 } 
end 

describe file('/opt/splunkforwarder/etc/apps/SplunkUniversalForwarder/default/limits.conf') do 
    it { should exist } 
    it { should be_owned_by 'nobody' } 
    it { should be_mode 444 } 
end 

describe file('/opt/splunkforwarder/etc/system/local/web.conf') do 
    it { should exist } 
    it { should be_owned_by 'nobody' } 
    it { should be_mode 600 } 
end 

,這一規範文件中的每個文件和目錄傳遞除了/opt/splunkforwarder/etc/apps/search/local/inputs.conf。我使用的是泊塢窗實例和測試廚房,所以當我登錄我發現:

  1. 文件存在
  2. 該文件是由「人」
  3. 該文件具有600個權限

完全像其他幾個文件。另外,我可以從我的Chef融合標準中看到使用正確的權限和所有權以及內容創建的文件。

我已經檢查過父目錄是否沒有被正確擁有,或者具有不同於其他文件通過但不是這種情況的權限。

我不知道爲什麼這不通過。

+3

什麼是該測試的詳細故障輸出? –

+0

您是否啓用並強制執行SELinux?如果是這樣,那麼input.conf中的audit.log中是否有任何條目? – jayhendren

回答

2

我懷疑測試中的錯字是你的敵人。

describe file('/opt/splunkforwarder/etc/apps/search/local/inputs.conf}') do

嘗試刪除支架,然後再次運行測試。

相關問題