diff options
author | Thom May <thom@may.lt> | 2018-02-12 19:10:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-12 19:10:47 +0100 |
commit | 3bd5d2a6be60c392aba534e217ac8f9a05704d40 (patch) | |
tree | acaf585045efdb4be42daecc1b9c2117a8e530d8 /lib/chef/provider | |
parent | a7d56100275045ad44e57386aad86e463788ee85 (diff) | |
parent | eecc7f1b297fd610ae9217b48baa0b05ccafaaf4 (diff) | |
download | chef-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.rb | 20 |
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 |