summaryrefslogtreecommitdiff
path: root/lib/chef/provider/systemd_unit.rb
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2016-05-31 18:14:43 +0100
committerThom May <thom@may.lt>2016-05-31 18:14:43 +0100
commita6e58cdbca5092faae9163120a0184ef29565e78 (patch)
tree8b5534a4aec170609e3c2c06edb4bc1bca8ec4de /lib/chef/provider/systemd_unit.rb
parentb7a1d984a1d883738f46c237238a4b4d46f9c47a (diff)
parentd8b3f05774613c949c8ed33a48122a27b2cd053a (diff)
downloadchef-a6e58cdbca5092faae9163120a0184ef29565e78.tar.gz
Merge pull request #4908 from nathwill/systemd-unit-try-actions
add systemd_unit try-restart, reload-or-restart, reload-or-try-restart actions
Diffstat (limited to 'lib/chef/provider/systemd_unit.rb')
-rw-r--r--lib/chef/provider/systemd_unit.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/chef/provider/systemd_unit.rb b/lib/chef/provider/systemd_unit.rb
index a73d0bc0ad..b96a336765 100644
--- a/lib/chef/provider/systemd_unit.rb
+++ b/lib/chef/provider/systemd_unit.rb
@@ -143,6 +143,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