Repository navigation
Conversation
validate_package_availability queries the packages API via mixlib_install.artifact_info even when download_url_override is set. The package URL and checksum already come from the user, so there is nothing to look up, and the lookup fails on hosts without internet access (the upgrade is skipped) and can return the wrong build for the platform (chef-cookbooks#266).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
validate_package_availability, added in #261 and released in 3.14.0, callsmixlib_install.artifact_infobefore every upgrade, even whendownload_url_overrideis set. In that case the package location (and usually the checksum) come from the user, so there's nothing to look up. The lookup still goes to Chef's packages API, and that causes two failures:packages.chef.io, which is common when packages are served from an internal mirror, which is exactly whydownload_url_overrideexists,artifact_infotimes out. The resource then logs:validate_windows_package_availabilitythen rejects it, even though the user pointeddownload_url_overrideat a valid package.This change returns early from
validate_package_availabilitywhendownload_url_overrideis set, and logs which URL will be used. Behavior withoutdownload_url_overrideis unchanged, so the CDN-propagation race protection from #261 still applies to downloads from Chef's servers.Before 3.14.0, an X.Y.Z version together with
download_url_overridedidn't need Chef's servers at all. This restores that for the validation step.Issues Resolved
download_url_overrideis set #228 (mixlib-install is consulted even whendownload_url_overrideis set)Check List
chef exec rspec spec/: 33 examples, 0 failures)spec/unit/libraries/chef_client_updater_helper_spec.rb:download_url_override, the packages API isn't queried, the Windows check is skipped, and the result istrue;letsets one by default.