summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-03-05 10:21:31 -0800
committerTim Smith <tsmith@chef.io>2018-03-05 10:21:31 -0800
commit60c0ea533b3f6645f66386758389125bd1ae987d (patch)
tree5a3665a18be4b9bfb69d17223679de88171c0e67
parent86a8e51cf16d87cbc57c2635324ab8a8a04a49d9 (diff)
downloadchef-60c0ea533b3f6645f66386758389125bd1ae987d.tar.gz
Properly validate reboot_action in dsc_resourcedsc_resource_reboot
Check the passed value to see if it's one of the values we support instead of failing hard later when the user passes the wrong thing. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/dsc_resource.rb9
1 files changed, 1 insertions, 8 deletions
diff --git a/lib/chef/resource/dsc_resource.rb b/lib/chef/resource/dsc_resource.rb
index 95ee32c946..f6c9468558 100644
--- a/lib/chef/resource/dsc_resource.rb
+++ b/lib/chef/resource/dsc_resource.rb
@@ -55,7 +55,6 @@ class Chef
super
@properties = ToTextHash.new
@resource = nil
- @reboot_action = :nothing
end
def resource(value = nil)
@@ -105,13 +104,7 @@ class Chef
# If the set method of the DSC resource indicate that a reboot
# is necessary, reboot_action provides the mechanism for a reboot to
# be requested.
- def reboot_action(value = nil)
- if value
- @reboot_action = value
- else
- @reboot_action
- end
- end
+ property :reboot_action, Symbol, default: :nothing, equal_to: [:nothing, :reboot_now, :request_reboot]
def timeout(arg = nil)
set_or_return(