Repository navigation
Conversation
tpowell-progress
force-pushed
the
chef-27761-pre-upgrade-validation
branch
from
June 15, 2026 19:19
22df82f to
4bf1934
Compare
mwrock
approved these changes
Jun 15, 2026
tpowell-progress
force-pushed
the
chef-27761-pre-upgrade-validation
branch
2 times, most recently
from
July 6, 2026 14:26
08330b8 to
807b413
Compare
…allations This change addresses CHEF-27761 by adding validation of package availability before performing destructive upgrade operations on Windows systems. This prevents systems from being left in a broken state if packages aren't available on CDN. Features: - Added validate_package_availability() method to check package readiness - Added validate_windows_package_availability() with retry logic for Windows - Integrated validation into upgrade action before destructive operations - Implements exponential backoff retry (2s, 4s, 8s) - 3 retries maximum, clear error messages - Prevents directory moves/backups if validation fails The validation is integrated seamlessly into the existing upgrade flow and requires no user code changes - it's automatic on every upgrade attempt. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Thomas Powell <104777878+tpowell-progress@users.noreply.github.com>
Add focused specs for CHEF-27761 validation behavior: - validate_package_availability success path and failure cases - windows validation delegation behavior - validate_windows_package_availability success and retry exhaustion These tests cover the newly added guardrails that prevent destructive upgrade operations when package URLs are unavailable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Thomas Powell <104777878+tpowell-progress@users.noreply.github.com>
The refactor now sleeps between retry attempts, so the failure-path spec should expect two sleeps for three attempts instead of three sleeps. This keeps the test aligned with the more idiomatic max_retries.times loop while preserving the same retry behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Thomas Powell <104777878+tpowell-progress@users.noreply.github.com>
Use a max_retries.times loop for the Windows package validation retry path, with a guard-clause style availability check in validate_package_availability. Behavior is unchanged; the code is just clearer and more Ruby-like. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Thomas Powell <104777878+tpowell-progress@users.noreply.github.com>
Signed-off-by: Thomas Powell <104777878+tpowell-progress@users.noreply.github.com>
Return false from validate_package_availability instead of raising, so a missing/unavailable artifact logs a warning and exits the action early without failing the entire Chef run. Other cookbooks continue. - validate_package_availability: raise -> return false + warn - validate_windows_package_availability: explicit true/false returns - providers/default.rb: return early before converge_by on false - specs: updated to assert false return + warn, not raise_error Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Thomas Powell <104777878+tpowell-progress@users.noreply.github.com>
- SECURITY.md: wrap bare URL, remove extra blank line - libraries/matchers.rb: remove ChefSpec matchers (auto-generated in 7.1+) - metadata.rb: remove respond_to?/defined? guards no longer needed in Chef 12.15+ - providers/default.rb: fix redundant return, use .last, remove redundant to_s in interpolation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Thomas Powell <104777878+tpowell-progress@users.noreply.github.com>
tpowell-progress
force-pushed
the
chef-27761-pre-upgrade-validation
branch
from
July 6, 2026 17:04
807b413 to
dcd688d
Compare
Signed-off-by: Thomas Powell <104777878+tpowell-progress@users.noreply.github.com>
Stromweld
approved these changes
Jul 8, 2026
This was referenced Nov 13, 2026
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.
Problem
During CDN propagation windows, Windows upgrades can fail after backup and move operations have already run — leaving the system without a working Chef client.
Solution
Add pre-upgrade package availability validation that checks the artifact URL exists (via HTTP HEAD + exponential backoff) before any destructive operations run. On failure, the cookbook exits gracefully so other cookbooks in the run continue unaffected.
Changes
libraries/chef_client_updater_helper.rb—validate_package_availabilityreturnsfalse(warn + skip) instead of raising;validate_windows_package_availabilitydoes the same on network failureproviders/default.rb—returnearly from the action when validation returnsfalse, beforeconverge_byrunsspec/— unit tests updated to assertfalsereturn + warn log on failure casesBehavior
Fixes: CHEF-27761