Reputation: 98
In my recipe I would like the control statement to skip auditing phase if the recipe is being run on CentOS 6 version.
I tried using the below for the control statement in RSpec but doesn't seem to work.
How can i use node attributes in control statements to make sure this audit does not run on CentOS 6.x versions and runs on rest of them?
I'm trying to use a recipe and have a control statement at the end like this:
control_group "gcloud test" do
control "gcloud" do
describe command("/usr/bin/gcloud --version") do
its(:exit_status) { should eq 0 }
not_if { node[:platform_family][:platform_version].to_i == '6' }
end
end
end
Upvotes: 0
Views: 617
Reputation: 54211
1) The in-recipe audit feature is deprecated and you should switch over to the audit
cookbook instead.
2) Wrap the whole thing with if node[:platform_family][:platform_version].to_i != '6' ... end
or similar.
Upvotes: 1