From d8b3f05774613c949c8ed33a48122a27b2cd053a Mon Sep 17 00:00:00 2001 From: Nathan Williams Date: Fri, 6 May 2016 14:37:46 -0700 Subject: add more unit actions --- lib/chef/provider/systemd_unit.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lib/chef/provider/systemd_unit.rb') diff --git a/lib/chef/provider/systemd_unit.rb b/lib/chef/provider/systemd_unit.rb index db71a6c234..3e6c2d3171 100644 --- a/lib/chef/provider/systemd_unit.rb +++ b/lib/chef/provider/systemd_unit.rb @@ -133,6 +133,24 @@ class Chef end end + def action_try_restart + converge_by("try-restarting unit: #{new_resource.name}") do + systemctl_execute!("try-restart", new_resource.name) + end + end + + def action_reload_or_restart + converge_by("reload-or-restarting unit: #{new_resource.name}") do + systemctl_execute!("reload-or-restart", new_resource.name) + end + end + + def action_reload_or_try_restart + converge_by("reload-or-try-restarting unit: #{new_resource.name}") do + systemctl_execute!("reload-or-try-restart", new_resource.name) + end + end + def active? systemctl_execute("is-active", new_resource.name).exitstatus == 0 end -- cgit v1.2.1