def define_resource_requirements
shared_resource_requirements
requirements.assert(:all_actions) do |a|
update_rcd = "/usr/sbin/update-rc.d"
a.assertion { ::File.exists? update_rcd }
a.failure_message Chef::Exceptions::Service, "#{update_rcd} does not exist!"
end
requirements.assert(:all_actions) do |a|
a.assertion { @priority_success }
a.failure_message Chef::Exceptions::Service, "/usr/sbin/update-rc.d -n -f #{@current_resource.service_name} failed - #{@rcd_status.inspect}"
a.whyrun ["Unable to determine priority of service, assuming service would have been correctly installed earlier in the run.",
"Assigning temporary priorities to continue.",
"If this service is not properly installed prior to this point, this will fail."] do
temp_priorities = {"6"=>[:stop, "20"],
"0"=>[:stop, "20"],
"1"=>[:stop, "20"],
"2"=>[:start, "20"],
"3"=>[:start, "20"],
"4"=>[:start, "20"],
"5"=>[:start, "20"]}
@current_resource.priority(temp_priorities)
end
end
end