summaryrefslogtreecommitdiff
path: root/lib/chef/resource/yum_package.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-12-01 11:07:23 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-12-13 13:31:50 -0800
commit8cbf7dc6717ee4e83c277f8f2698cad5fd168773 (patch)
treee947e3f7505afdebe0c5a25f76362ed8d354e9d3 /lib/chef/resource/yum_package.rb
parent79def53a87c29eb92a1f3db6bc7266d7e8049113 (diff)
downloadchef-8cbf7dc6717ee4e83c277f8f2698cad5fd168773.tar.gz
add flush_cache and fix yum's
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/resource/yum_package.rb')
-rw-r--r--lib/chef/resource/yum_package.rb31
1 files changed, 18 insertions, 13 deletions
diff --git a/lib/chef/resource/yum_package.rb b/lib/chef/resource/yum_package.rb
index f8b670bd93..1e0ad197ba 100644
--- a/lib/chef/resource/yum_package.rb
+++ b/lib/chef/resource/yum_package.rb
@@ -26,22 +26,27 @@ class Chef
# Install a specific arch
property :arch, [ String, Array ]
- # the {} on the proc here is because rspec chokes if it's do...end
+
property :flush_cache,
- Hash,
- default: { before: false, after: false },
- coerce: proc { |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
- }
+ Hash,
+ default: { before: false, after: false },
+ coerce: proc { |v|
+ if v.is_a?(Hash)
+ v
+ elsif v.is_a?(Array)
+ v.each_with_object({}) { |arg, obj| obj[arg] = true }
+ elsif v.is_a?(TrueClass) || v.is_a?(FalseClass)
+ { before: v, after: v }
+ elsif v == :before
+ { before: true, after: false }
+ elsif v == :after
+ { after: true, before: false }
+ end
+ }
+
property :allow_downgrade, [ true, false ], default: false
- property :yum_binary, String
+ property :yum_binary, String
end
end
end