我有一个不太复杂的Ruby Inspec文件,但我不知道如何正确地构建它。我基本上需要检查rsync
是否 * 未安装 * 或禁用。为了检查它是否被禁用,我运行systemctl is-active rsync
和systemctl is-enabled rsync
。然后我将输出分别与inactive
和disabled
匹配。
control "my control" do
title "title"
desc "desc"
describe.one do
describe package('rsync') do
it { should_not be_installed }
end
# These two should be treated as one option
describe command('systemctl is-active rsync') do
its('stdout') { should match "^inactive$" }
end
describe command('systemctl is-enabled rsync') do
its('stdout') { should match "^disabled$" }
end
end
end
字符串
1条答案
按热度按时间z4iuyo4d1#
试试这样的东西:
字符串
或者你应该能够做这样的事情:
型