diff options
author | Steven Danna <steve@opscode.com> | 2014-04-02 16:46:01 -0700 |
---|---|---|
committer | Steven Danna <steve@opscode.com> | 2014-04-02 16:46:01 -0700 |
commit | ca9895a6154d8199e0c57a469bd22ff0599daf9f (patch) | |
tree | ecad9207e6b1dd75fa811d191e70a7ef53591f42 /lib/chef/resource/mount.rb | |
parent | 932d7656ff4d8afcb672359b1d622d64a4adc15e (diff) | |
download | chef-ca9895a6154d8199e0c57a469bd22ff0599daf9f.tar.gz |
[CHEF-5163] Support lazy evaluation the mount resource's options attr
set_or_return calls #call on any DelayedEvaluator on read and compares
the results against the parameter validations. This patch adds String
to the evaluation but ensure that someone reading the options value
will only ever get an Array, keeping the original contract.
Diffstat (limited to 'lib/chef/resource/mount.rb')
-rw-r--r-- | lib/chef/resource/mount.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/chef/resource/mount.rb b/lib/chef/resource/mount.rb index 49984630c0..507c5329e3 100644 --- a/lib/chef/resource/mount.rb +++ b/lib/chef/resource/mount.rb @@ -81,16 +81,17 @@ class Chef end def options(arg=nil) - if arg.is_a?(String) - converted_arg = arg.gsub(/,/, ' ').split(/ /) + ret = set_or_return( + :options, + arg, + :kind_of => [ Array, String ] + ) + + if ret.is_a? String + ret.gsub(/,/, ' ').split(/ /) else - converted_arg = arg + ret end - set_or_return( - :options, - converted_arg, - :kind_of => [ Array ] - ) end def dump(arg=nil) @@ -162,4 +163,3 @@ class Chef end end end - |