I am new to InSpec and I am just wondering if you can use the only_if statement with a control? For example, if its("stdout") { should include "SELINUXTYPE" }
fails I want to execute another control. If it passes, I want to skip the next control. How would I do this? The whole test would look something like this:
control "SELinux" do
describe bash("more /etc/selinux/config | grep "SELINUX") do
its("stdout") { should include "SELINUX=targeted" }
**if the above control fails, run this next one. Otherwise, skip it**
its("stdout") { should include "SELINUX=mls" }
end
end
If this is bad practice or if it's just horrendously wrong, let me know. I'm very new to this so I'm all up for learning!