fix: improve logs when Ubuntu Pro credentials are not available - #326
Open
cristiangirlea wants to merge 1 commit into
Open
cristiangirlea wants to merge 1 commit into
cristiangirlea wants to merge 1 commit into
Conversation
When a release defines Ubuntu Pro archives and no credentials are
available, Chisel logged an error-like message for every Pro archive
("Cannot open credentials directory ...") followed by one "Archive
... ignored: credentials not found" line per archive. Users not using
Pro archives at all found this confusing.
A missing credentials directory is now handled silently (other errors
opening it are still logged), and the archives ignored because of
missing credentials are reported in a single informative message:
Ubuntu Pro subscription not available, ignoring archives: ubuntu-esm-apps, ubuntu-esm-infra
When valid credentials are available the logs are unchanged.
Fixes canonical#207
Assisted-by: AI tools
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.
Fixes #207
When a release defines Ubuntu Pro archives (as
ubuntu-24.04does) and nocredentials are available,
chisel cutlogged an error-like message forevery Pro archive followed by a per-archive "ignored" line. Users not
using Pro archives at all found this confusing, and nothing tied the
messages to Ubuntu Pro.
As discussed in #207, Chisel now emits a single informative message when
Pro credentials are not available and stays quiet about it otherwise.
When valid credentials are present the logs are unchanged.
Changes
internal/archive: a missing credentials directory is treated as thenormal "no Pro credentials" case and is no longer logged. Any other error
opening the directory (for example a permission problem) is still logged.
The doc comment of
findCredentialsInDirwas also corrected: it claimedthe function returns empty credentials with a nil error, but it returns
ErrCredentialsNotFound.cmd/chisel:cutanddebug check-release-archivescollect the archivesignored because of missing credentials and report them once, sorted, via a
small shared helper.
TestFindCredentialsInDirMissingDirasserts nothing is logged for amissing directory, and a new
TestRunIgnoresProArchivesWithoutCredentialscovers the single-message behaviour through
debug check-release-archives(which has the
archiveOpenhook;cutshares the same logic).Verification
go test ./...passes andgo vet ./...reports nothing new (its onlyoutput is pre-existing unkeyed-field warnings in
internal/setuptests).Both new tests fail on
mainand pass with this change.Before / after with a real release, no credentials directory:
CHISEL_AUTH_DIR=/nonexistent chisel cut --release ubuntu-24.04 --root /tmp/rootfs base-files_baseBefore:
After:
The wording follows the suggestion in #207; happy to adjust it.
Assisted-by: AI tools