summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Dibowitz <phil@ipom.com>2016-08-26 15:04:49 -0700
committerPhil Dibowitz <phil@ipom.com>2016-08-26 16:49:08 -0700
commite4e855e05dc88c4a66f04d279bafca40293fffae (patch)
treeba11be3fc44f518169164c0a0a142982d5787130
parenta2d97bc74c78bdf6ce395bae0db64e5a5f95d81b (diff)
downloadchef-e4e855e05dc88c4a66f04d279bafca40293fffae.tar.gz
Fix flush_cache issues in yum_package
Fixes #4691. I hope.
-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