Skip to content

fix: preserve zero user and group IDs when merging Pebble exec checks - #2867

Merged
tonyandrewmeyer merged 3 commits into
canonical:mainfrom
nancy6547:fix/check-exec-zero-ids
Nov 10, 2026
Merged

tonyandrewmeyer merged 3 commits into
canonical:mainfrom
nancy6547:fix/check-exec-zero-ids

Conversation

@nancy6547

@nancy6547 nancy6547 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

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.

@tonyandrewmeyer tonyandrewmeyer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. Please fix the failing type check, and put in the issue number in the description to link the PR to the issue.

@james-garner-canonical james-garner-canonical left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. A suggestion on how to resolve the type checker issue.

Comment thread ops/pebble.py Resolved
Co-authored-by: James Garner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check._merge_exec ignores user-id/group-id 0 in override layers

3 participants