summaryrefslogtreecommitdiff
path: root/lib/chef/provider/reboot.rb
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2017-12-15 15:44:12 -0800
committerTim Smith <tsmith@chef.io>2017-12-15 15:51:40 -0800
commit0d1072d74f711bb180b4c8d075309c3934eb06a6 (patch)
tree5a3d2da5d944a7d1b4f5bb00e72f9ca21e729324 /lib/chef/provider/reboot.rb
parent10252cc8f4f855d5de65efb645583f89bf8771f2 (diff)
downloadchef-0d1072d74f711bb180b4c8d075309c3934eb06a6.tar.gz
Modernize reboot resource and add spec
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/provider/reboot.rb')
-rw-r--r--lib/chef/provider/reboot.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/chef/provider/reboot.rb b/lib/chef/provider/reboot.rb
index 32dc38f788..c09fbaa2c0 100644
--- a/lib/chef/provider/reboot.rb
+++ b/lib/chef/provider/reboot.rb
@@ -21,9 +21,19 @@ require "chef/provider"
class Chef
class Provider
+ # Use the reboot resource to reboot a node, a necessary step with some
+ # installations on certain platforms. This resource is supported for use on
+ # the Microsoft Windows, macOS, and Linux platforms.
+ #
+ # In using this resource via notifications, it's important to *only* use
+ # immediate notifications. Delayed notifications produce unintuitive and
+ # probably undesired results.
+ #
+ # @since 12.0.0
class Reboot < Chef::Provider
provides :reboot
+ # @return [void]
def load_current_resource
@current_resource ||= Chef::Resource::Reboot.new(new_resource.name)
current_resource.reason(new_resource.reason)
@@ -31,6 +41,8 @@ class Chef
current_resource
end
+ # add a reboot to the node run_context
+ # @return [void]
def request_reboot
node.run_context.request_reboot(
:delay_mins => new_resource.delay_mins,