Repository navigation
fix: preserve zero user and group IDs in Pebble services - #2847
Merged
Merged
Conversation
ItsM0rty
marked this pull request as ready for review
October 26, 2026 05:00
Contributor
Author
|
Thanks for the review and for updating the tests @benhoyt; glad the fix looks good. |
james-garner-canonical
approved these changes
Nov 4, 2026
This was referenced Nov 8, 2026
tonyandrewmeyer
pushed a commit
that referenced
this pull request
Nov 10, 2026
…#2867) Fixes #2881 `Check._merge_exec` skipped falsy values, so an override layer that sets an exec check's `user-id: 0` or `group-id: 0` (root) kept the previous IDs. Pebble's `ExecCheck.Merge` only skips nil IDs (`if other.UserID != nil`), so the plan merged by Harness and `ops.testing` differed from the real one. This treats only `None` as unset for the exec `user-id` and `group-id`, the same approach #2847 took for services. Other exec fields keep the current behaviour. Test: `TestCheck.test_merge_exec_zero_ids` in `test/test_pebble.py` merges a layer with zero IDs over one with 1000/2000 (expects 0/0), then merges a layer without IDs (expects 0/0 to stay). It fails on main. --------- Co-authored-by: James Garner <[email protected]>
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 #2846.
Pebble service serialization drops
user-id: 0andgroup-id: 0. Merging a zero ID also keeps the previous ID, so the resulting configuration can differ from what the charm requested.This keeps zero as an explicit identity and still omits unset IDs. Added regressions for both fields through service and layer serialization, plus merging.
Validation: the full Linux unit run passes with 2,483 tests and 56 skips; the release-script tests add 13 passes. The Pebble client file passes all 198 tests. All four new cases fail on unchanged upstream. Full Ruff, codespell and Pyright checks pass.
The Linux test copy uses LF line endings and restored executable bits from Git. The docs build passes after fetching the full Git history, which the documentation timestamp extension requires. No Juju controller or live Pebble daemon was used.