I will be calling linux_reboot once there is an kernel update.
added this code in recipe for reboot:;
linux_reboot 'kernel updated' do
action :reboot
end
----------------------------------------------------
resource/reboot.rb
------------------------------------------------------
actions :reboot
default_action :reboot
attribute :happened, kind_of: String
attr_accessor :exists
-----------------------------------------------------------
provider/reboot.rb
------------------------------------------------------
def whyrun_supported?
true
end
action :reboot do
Chef::Log.info "=== Cookbook: #{cookbook_name}"
Chef::Log.info "=== Resource Name: #{@
new_resource.name}"
if @current_resource.happened
Chef::Log.info 'Reboot happened'
else
converge_by("Reboot system") do
reboot
end
end
end
def load_current_resource
@current_resource = Chef::Resource::linuxReboot.new(@
new_resource.name)
@current_resource.happened = false
begin
# search for a file and set the flag..