Repository navigation
fix: retry a failed CA bundle update and compare the bundle byte for byte - #65
Merged
Merged
Conversation
nsklikas
force-pushed
the
retry-ca-bundle-update
branch
from
October 23, 2026 11:57
3efd2a6 to
c0a8c36
Compare
nsklikas
force-pushed
the
retry-ca-bundle-update
branch
from
November 19, 2026 13:59
c0a8c36 to
2d01e16
Compare
nsklikas
marked this pull request as ready for review
November 20, 2026 10:17
natalian98
approved these changes
Nov 23, 2026
…byte The charm keeps a copy of the CA bundle and acts only when the bundle differs from it. The copy was written before update-ca-certificates ran and before the result was pushed to the workload, and only a failure of the first step was handled, by removing the copy. A push that failed left the copy equal to the bundle, so the next hook did nothing and the unit ended active without the CA; a removal that failed was never tried again. Both steps are now in one try, a Pebble error and an OSError (a request that times out, a missing binary) are caught too, and on failure the earlier copy is put back, so that the next reconciliation runs both steps again. The copy was also read as text, which turns CRLF into LF: a bundle with CRLF line endings never equalled its copy, and every hook wrote the copy and ran update-ca-certificates again. It is now read without newline translation.
nsklikas
force-pushed
the
retry-ca-bundle-update
branch
from
November 23, 2026 14:37
2d01e16 to
c3651bf
Compare
nsklikas
enabled auto-merge
November 23, 2026 14:38
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.
What
Two gaps in how the charm applies the CA bundle of
receive-ca-cert(_ensure_tls). Nothing has to merge before this, and nothing waits for it.A failed update was not always tried again. The charm keeps a copy of the bundle and acts only when the bundle differs from it. It wrote the copy before it ran
update-ca-certificatesand pushed the result to the workload, and it handled only a failure of the first step, by removing the copy:Both steps are now in one
try, a Pebble error and anOSError(a request to Pebble that times out, a missing binary) are caught too, and on failure the earlier copy is put back, so the next reconciliation sees a difference and runs both steps again.A bundle with CRLF line endings never equalled its copy. The copy was read as text, which turns
\r\ninto\n, so every hook wrote the copy again, ranupdate-ca-certificatesand pulled the workload's file to compare. The copy is now read without newline translation.Good to know
Tests