summaryrefslogtreecommitdiff
path: root/lib/chef/provider/systemd_unit.rb
diff options
context:
space:
mode:
authorNathan Williams <nath.e.will@gmail.com>2018-02-07 23:09:51 -0800
committerNathan Williams <nath.e.will@gmail.com>2018-02-07 23:14:36 -0800
commiteecc7f1b297fd610ae9217b48baa0b05ccafaaf4 (patch)
tree055dbff45761629c93d9c02092ceb21b76a24b56 /lib/chef/provider/systemd_unit.rb
parent051b99d77cefe42d0a7c1f56ec9dc2c60f3f4b84 (diff)
downloadchef-eecc7f1b297fd610ae9217b48baa0b05ccafaaf4.tar.gz
add additional systemd unit actions
Signed-off-by: Nathan Williams <nath.e.will@gmail.com>
Diffstat (limited to 'lib/chef/provider/systemd_unit.rb')
-rw-r--r--lib/chef/provider/systemd_unit.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/chef/provider/systemd_unit.rb b/lib/chef/provider/systemd_unit.rb
index e1853bd984..5a338d2e2e 100644
--- a/lib/chef/provider/systemd_unit.rb
+++ b/lib/chef/provider/systemd_unit.rb
@@ -1,6 +1,6 @@
#
# Author:: Nathan Williams (<nath.e.will@gmail.com>)
-# Copyright:: Copyright 2016, Nathan Williams
+# Copyright:: Copyright 2016-2018, Nathan Williams
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -74,6 +74,18 @@ class Chef
end
end
+ def action_preset
+ converge_by("restoring enable/disable preset configuration for unit: #{new_resource.unit_name}") do
+ systemctl_execute!(:preset, new_resource.unit_name)
+ end
+ end
+
+ def action_revert
+ converge_by("reverting to vendor version of unit: #{new_resource.unit_name}") do
+ systemctl_execute!(:revert, new_resource.unit_name)
+ end
+ end
+
def action_enable
if current_resource.static
Chef::Log.debug("#{new_resource.unit_name} is a static unit, enabling is a NOP.")
@@ -98,6 +110,12 @@ class Chef
end
end
+ def action_reenable
+ converge_by("reenabling unit: #{new_resource.unit_name}") do
+ systemctl_execute!(:reenable, new_resource.unit_name)
+ end
+ end
+
def action_mask
unless current_resource.masked
converge_by("masking unit: #{new_resource.unit_name}") do