diff options
author | John Keiser <john@johnkeiser.com> | 2015-06-04 08:35:26 -0700 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-06-23 15:23:02 -0700 |
commit | 1d96b8c7bb96a476625a026bea58dd0f251af716 (patch) | |
tree | 4b68570dbb87c4b0cfca2e3a9f30bf3fd3d7e1db /lib/chef/resource.rb | |
parent | d91ed1d763aa35b29d22d712077bc965ce7098b2 (diff) | |
download | chef-1d96b8c7bb96a476625a026bea58dd0f251af716.tar.gz |
Allow values to be set to nil (override defaults) if user allows it
Diffstat (limited to 'lib/chef/resource.rb')
-rw-r--r-- | lib/chef/resource.rb | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index 44247ca9f0..9496656705 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -58,8 +58,6 @@ class Chef include Chef::Mixin::ShellOut include Chef::Mixin::PowershellOut - NULL_ARG = Object.new - # # The node the current Chef run is using. # @@ -773,10 +771,10 @@ class Chef # @example With type and options # property :x, String, default: 'hi' # - def self.property(name, type=NULL_ARG, **options) + def self.property(name, type=NOT_PASSED, **options) name = name.to_sym - if type != NULL_ARG + if type != NOT_PASSED if options[:is] options[:is] = ([ type ] + [ options[:is] ]).flatten(1) else @@ -784,7 +782,7 @@ class Chef end end - define_method(name) do |value=nil| + define_method(name) do |value=NOT_PASSED| set_or_return(name, value, options) end define_method("#{name}=") do |value| @@ -868,8 +866,8 @@ class Chef # have. # attr_accessor :allowed_actions - def allowed_actions(value=NULL_ARG) - if value != NULL_ARG + def allowed_actions(value=NOT_PASSED) + if value != NOT_PASSED self.allowed_actions = value end @allowed_actions @@ -1003,9 +1001,9 @@ class Chef # # @return [Symbol] The name of this resource type (e.g. `:execute`). # - def self.resource_name(name=NULL_ARG) + def self.resource_name(name=NOT_PASSED) # Setter - if name != NULL_ARG + if name != NOT_PASSED remove_canonical_dsl # Set the resource_name and call provides @@ -1095,8 +1093,8 @@ class Chef # # @return [Symbol,Array<Symbol>] The default actions for the resource. # - def self.default_action(action_name=NULL_ARG) - unless action_name.equal?(NULL_ARG) + def self.default_action(action_name=NOT_PASSED) + unless action_name.equal?(NOT_PASSED) if action_name.is_a?(Array) @default_action = action_name.map { |arg| arg.to_sym } else |