Skip to content

Commit

Permalink
Allow people to pass in a 'source' to package rules
Browse files Browse the repository at this point in the history
Fixes chef#3008
  • Loading branch information
jaymzh committed Mar 3, 2015
1 parent 370422a commit 1f380f9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/chef/provider/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ def define_resource_requirements
a.whyrun("Assuming a repository that offers #{forced_packages_missing_candidates.join(", ")} would have been configured")
end

# XXX: Does it make sense to pass in a source with :upgrade? Probably
# not, but as with the above comment, we don't yet enforce such a thing,
# so we'll just leave things as-is for now.
requirements.assert(:upgrade, :install) do |a|
a.assertion { candidates_exist_for_all_uninstalled? }
a.assertion { candidates_exist_for_all_uninstalled? || new_resource.source }
a.failure_message(Chef::Exceptions::Package, "No candidate version available for #{packages_missing_candidates.join(", ")}")
a.whyrun("Assuming a repository that offers #{packages_missing_candidates.join(", ")} would have been configured")
end
Expand Down

0 comments on commit 1f380f9

Please sign in to comment.