You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is the compliance_profile has both the :fetch AND :execute action. The :fetch action works and touches the interval file immediately so when the :execute action runs the only_if guard is rechecked and sees (incorrectly) that the interval has not passed.
I tested changing the notifies to a :delayed instead of :immediately and it fixed this for me. The compliance_profile fetched AND executed properly according to the interval.
Workaround
Putting the following in my audit wrapper cookbook's default.rb recipe worked for me. It creates :delayed notifications and deletes the :immediate notifications.
include_recipe 'audit'
run_context.immediate_notification_collection.each do |k,v|
if (k =~ /^compliance_profile\[\w*\]$/) && (v.first.action == :touch)
resources(k).notifies :touch, v.first.resource, :delayed
end
end
run_context.immediate_notification_collection.delete_if { |k,v| (k =~ /^compliance_profile\[\w*\]$/) && (v.first.action == :touch) }
The text was updated successfully, but these errors were encountered:
Cookbook version
0.14.4
Chef-client version
Chef: 12.14.89
Platform Details
Ubuntu 14.04
Scenario:
Setting the interval attributes doesn't work. The compliance profiles are never executed.
Steps to Reproduce:
I use a wrapper cookbook to set the following attributes. I'm setting the interval to 1 minute for troubleshooting purposes.
Expected Result:
The compliance_profile should fetch AND execute properly according to the interval.
Actual Result:
Run
chef-client -l debug
and notice that the compliance profiles are fetched but they are not executed at all. (skipped due to only_if)The file that is used to calculate if the interval has passed is being touched by the compliance_profile's notifies property.
The problem is the compliance_profile has both the
:fetch
AND:execute
action. The:fetch
action works and touches the interval file immediately so when the:execute
action runs theonly_if
guard is rechecked and sees (incorrectly) that the interval has not passed.I tested changing the
notifies
to a:delayed
instead of:immediately
and it fixed this for me. The compliance_profile fetched AND executed properly according to the interval.Workaround
Putting the following in my audit wrapper cookbook's default.rb recipe worked for me. It creates
:delayed
notifications and deletes the:immediate
notifications.The text was updated successfully, but these errors were encountered: