We need to run chef in "checking mode" first for our project - which is either "why-run" or "audit-only" modes. We are inclined towards "audit-only" mode because there is no "node save" at the end of "why run" run.
So for the audit mode - we would like to get access to a number of variables in the environment when the test fails. To this end, we implemented an event handler that gets activated when audit failure happens. The event we use is:
control_example_failure(control_group_name, example_data, error)
Here is the control group we are using for audit:
control_group "audit service running" do
control "ntp audit" do
it "should be running" do
newService = "ntp2" #Variables we defined.
stats = "ntpstats"
expect(service("ntpd")).to be_running
end
end
end
Here is what we found in the "example_data" structure:
{:name=>"should be running",
:desc=>"audit service running ntp audit should be running",
:resource_type=>nil, :resource_name=>nil,
:context=>["ntp audit"],
:line_number=>14
}
Is there a way for us to access any of the internal variables like "newService" and "stats" from the example_data, or any other way from Audit results? As the output of audit - we would like to get values of other relevant variables within the control group. Thank you.
regards,
Bhavna
Archive powered by MHonArc 2.6.16.