summaryrefslogtreecommitdiff
path: root/lib/chef/resource/yum_package.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/resource/yum_package.rb')
-rw-r--r--lib/chef/resource/yum_package.rb20
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/chef/resource/yum_package.rb b/lib/chef/resource/yum_package.rb
index 1f749b93c0..e73c28c4cd 100644
--- a/lib/chef/resource/yum_package.rb
+++ b/lib/chef/resource/yum_package.rb
@@ -27,18 +27,16 @@ class Chef
# Install a specific arch
property :arch, [ String, Array ]
- property :flush_cache, Hash, default: { before: false, after: false }, coerce: proc { |v|
- # TODO these append rather than set. This is probably wrong behavior, but we're preserving it until we know
- if v.is_a?(Array)
- v.each { |arg| flush_cache[arg] = true }
- flush_cache
- elsif v.any?
- v
- else
- # TODO calling flush_cache({}) does a get instead of a set. This is probably wrong behavior, but we're preserving it until we know
- flush_cache
+ property :flush_cache, Hash, default: { before: false, after: false },
+ coerce: proc do |v|
+ if v.is_a?(Array)
+ v.each_with_object({}) { |arg, obj| obj[arg] = true }
+ elsif v.any?
+ v
+ else
+ { before: v, after: v }
+ end
end
- }
property :allow_downgrade, [ true, false ], default: false
property :yum_binary, String