summaryrefslogtreecommitdiff
path: root/lib/chef/provider
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2018-02-12 19:10:47 +0100
committerGitHub <noreply@github.com>2018-02-12 19:10:47 +0100
commit3bd5d2a6be60c392aba534e217ac8f9a05704d40 (patch)
treeacaf585045efdb4be42daecc1b9c2117a8e530d8 /lib/chef/provider
parenta7d56100275045ad44e57386aad86e463788ee85 (diff)
parenteecc7f1b297fd610ae9217b48baa0b05ccafaaf4 (diff)
downloadchef-3bd5d2a6be60c392aba534e217ac8f9a05704d40.tar.gz
Merge pull request #6835 from nathwill/sd-moar-actions
add additional systemd_unit actions
Diffstat (limited to 'lib/chef/provider')
-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 dcef93bfde..420438775c 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