summaryrefslogtreecommitdiff
path: root/lib/chef/resource
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/resource
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/resource')
-rw-r--r--lib/chef/resource/reboot.rb34
1 files changed, 14 insertions, 20 deletions
diff --git a/lib/chef/resource/reboot.rb b/lib/chef/resource/reboot.rb
index 519defa602..bdaa755533 100644
--- a/lib/chef/resource/reboot.rb
+++ b/lib/chef/resource/reboot.rb
@@ -18,31 +18,25 @@
require "chef/resource"
-# In using this resource via notifications, it's important to *only* use
-# immediate notifications. Delayed notifications produce unintuitive and
-# probably undesired results.
class Chef
class Resource
+ # 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::Resource
- allowed_actions :request_reboot, :reboot_now, :cancel
-
- def initialize(name, run_context = nil)
- super
- @provider = Chef::Provider::Reboot
-
- @reason = "Reboot by Chef"
- @delay_mins = 0
+ resource_name :reboot
- # no default action.
- end
-
- def reason(arg = nil)
- set_or_return(:reason, arg, :kind_of => String)
- end
+ allowed_actions :request_reboot, :reboot_now, :cancel
+ default_action :nothing # make sure people are quite clear what they want
- def delay_mins(arg = nil)
- set_or_return(:delay_mins, arg, :kind_of => Integer)
- end
+ property :reason, String, default: "Reboot by Chef"
+ property :delay_mins, Integer, default: 0
end
end
end