fix(enroll): eleventh audit — container liveness, silent set-e exits, &&||antipattern, age-key remediation#183
Merged
Merged
Conversation
… &&||antipattern, age-key remediation
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.
Summary
MAX_WAITtimeout.docker exec katello-foreman ... 2>/dev/nullsilently swallows the "container not running" error and the loop keeps counting. Addeddocker ps --filter status=runningliveness check inside the loop that dies immediately with logs/restart commands. Also tightened progress interval from 60s to 30s.nixos-generate-config ... > ${HW_CONFIG}.tmp: failure triggered silentset -eexit with no remediation message. Added|| diewithjournalctlhint.KATELLO_PASSWORD=$(cat "${KATELLO_ADMIN_PW_FILE}"): missing file (not just empty) causedcatto exit non-zero, firingset -ebefore the guard die with regeneration steps could run. Added file-existence pre-check with clearrm + re-runremediation.age-keygen -y "${AGE_KEY}": corrupt key exited non-zero, firingset -ebefore the empty-guard die. Added|| diewith full regeneration instructions including removingsecrets.yaml.nix copy ... && ok ... || warn ...(×2 in step 11): classic&&...||anti-pattern — ifokexits non-zero for any reason,warnfires on a successful push. Replaced both withif/else.&&...||in Katello CV promotion loop. Replaced withif/else.Test plan
bash -n scripts/enroll.sh— syntax cleankatello-foremancontainer mid-wait → immediate die with logs command (not 30-min timeout)hardware-configuration.nixtarget dir (simulate nixos-generate-config fail) → clear diekatello-admin-passwordfile before step 4 exits → pre-check die fires with correct remediationage.key, run step 3 re-entry →age-keygen -y||die fires with rm instructionsnix copyif/else branches each print correctly