diff options
author | Phil Dibowitz <phil@ipom.com> | 2015-01-16 13:14:43 -0800 |
---|---|---|
committer | Phil Dibowitz <phil@ipom.com> | 2015-02-03 19:32:36 -0800 |
commit | 0665a18112e269b0a8f81ad021cd88af84421fe9 (patch) | |
tree | 05b0b992c7319b0226e009bc859cbb98c8b4177e | |
parent | 44f9c8e19e88b4262801f9d470cf3e930411791a (diff) | |
download | chef-0665a18112e269b0a8f81ad021cd88af84421fe9.tar.gz |
Support dependency detection, fix caching invalidation issues
-rw-r--r-- | lib/chef/provider/package/yum.rb | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb index 2eab067af3..0debba8267 100644 --- a/lib/chef/provider/package/yum.rb +++ b/lib/chef/provider/package/yum.rb @@ -1058,9 +1058,18 @@ class Chef # 3) or a dependency, eg: "foo >= 1.1" # Check if we have name or name+arch which has a priority over a dependency - unless @yum.package_available?(@new_resource.package_name) - # If they aren't in the installed packages they could be a dependency - parse_dependency + package_name_array.each do |n| + unless @yum.package_available?(n) + # If they aren't in the installed packages they could be a dependency + dep = parse_dependency(n) + if dep + if @new_resource.package_name.is_a?(Array) + @new_resource.package_name(package_name_array + [dep]) + else + @new_resource.package_name(dep) + end + end + end end # Don't overwrite an existing arch @@ -1268,9 +1277,9 @@ class Chef # matching them up with an actual package so the standard resource handling can apply. # # There is currently no support for filename matching. - def parse_dependency + def parse_dependency(name) # Transform the package_name into a requirement - yum_require = RPMRequire.parse(@new_resource.package_name) + yum_require = RPMRequire.parse(name) # and gather all the packages that have a Provides feature satisfying the requirement. # It could be multiple be we can only manage one packages = @yum.packages_from_require(yum_require) @@ -1304,7 +1313,7 @@ class Chef "specific version.") end - @new_resource.package_name(new_package_name) + new_package_name end end |