summaryrefslogtreecommitdiff
path: root/lib/chef/resource/powershell_script.rb
diff options
context:
space:
mode:
authorAdam Edwards <adamed@opscode.com>2014-03-29 00:20:08 -0700
committerAdam Edwards <adamed@opscode.com>2014-03-29 00:21:14 -0700
commit718de5b01c5458e512004bf072618052ffa654bc (patch)
treef6ebe786d641ad260c399cf776adec8ce6e218a0 /lib/chef/resource/powershell_script.rb
parentbada8aeb8cdac4779a0d65d4d3fd9333910fc886 (diff)
downloadchef-718de5b01c5458e512004bf072618052ffa654bc.tar.gz
CR feedback: clean up convert boolean expressions and add tests
Diffstat (limited to 'lib/chef/resource/powershell_script.rb')
-rw-r--r--lib/chef/resource/powershell_script.rb18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/chef/resource/powershell_script.rb b/lib/chef/resource/powershell_script.rb
index 08568b6964..f053d0b2aa 100644
--- a/lib/chef/resource/powershell_script.rb
+++ b/lib/chef/resource/powershell_script.rb
@@ -36,16 +36,18 @@ class Chef
)
end
- def only_if(command=nil, opts={}, &block)
- augmented_opts = opts.merge((guard_interpreter.nil? || guard_interpreter == :default) ? {} : {:convert_boolean_return => true}) {|key, original_value, augmented_value| original_value}
- super(command, augmented_opts, &block)
- end
+ protected
- def not_if(command=nil, opts={}, &block)
- augmented_opts = opts.merge((guard_interpreter.nil? || guard_interpreter == :default) ? {} : {:convert_boolean_return => true}) {|key, original_value, augmented_value| original_value}
- super(command, augmented_opts, &block)
+ # Allow callers evaluating guards to request default
+ # attribute values. This is needed to allow
+ # convert_boolean_return to be true in guard context by default,
+ # and false by default otherwise. When this mode becomes the
+ # default for this resource, this method can be removed since
+ # guard context and recipe resource context will have the
+ # same behavior.
+ def self.get_default_attributes(opts)
+ {:convert_boolean_return => true}
end
-
end
end
end