Chef infra serverspec在一个且仅一个文件上不断失败

Chef infra serverspec在一个且仅一个文件上不断失败,chef-infra,serverspec,Chef Infra,Serverspec,我有一本食谱,是关于建立一个Splunk货代的。我已经为配置文件创建了许多integration-serverspec测试。特别是其中一个文件,/opt/splunkforwarder/etc/apps/search/local/inputs.conf总是无法通过其他文件通过的所有测试。我的代码如下所示: require 'spec_helper' describe file('/opt/splunkforwarder/etc/apps/search/local/') do it { sh

我有一本食谱,是关于建立一个Splunk货代的。我已经为配置文件创建了许多integration-serverspec测试。特别是其中一个文件,
/opt/splunkforwarder/etc/apps/search/local/inputs.conf
总是无法通过其他文件通过的所有测试。我的代码如下所示:

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
,此规范文件中的每个文件和目录都会通过。我正在使用Docker实例和Test Kitchen,因此当我登录时,我发现:

  • 该文件已存在
  • 该文件归“无人”所有
  • 该文件有600个权限
  • 与其他几个文件完全相同。此外,我可以从我的文档中看到创建的文件具有正确的权限和所有权以及内容

    我已经检查了是否有一个父目录的所有权不正确,或者与通过的其他文件具有不同的权限,但事实并非如此


    我不知道为什么考试不及格。

    我怀疑考试中的打字错误是你的敌人

    描述文件('/opt/splunkforwarder/etc/apps/search/local/inputs.conf
    }
    ')do


    尝试删除该括号并再次运行测试。

    该测试的详细失败输出是什么?是否启用并强制执行SELinux?如果是,audit.log中是否有inputs.conf的条目?