[LP#2143365] When containerd is installed by resource, don't restart service with apt#98
[LP#2143365] When containerd is installed by resource, don't restart service with apt#98
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes LP#2143365 by preventing containerd service restarts triggered by apt when containerd is resource-managed (e.g., during upgrade-charm), while still allowing apt reinstall to refresh systemd units/configs/deps.
Changes:
- Update
upgrade_charm()to reinstall containerd packages without restarting services when a containerd resource is installed. - Add
_apt_restart_services()context manager to control apt/needrestart behavior duringapt_install. - Add unit test coverage for
_apt_restart_services()and remove stray whitespace in test files.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/reactive/containerd.py |
Adds restart-suppression context manager and uses it to avoid restarts during resource-managed upgrade-charm reinstalls. |
tests/unit/test_containerd_reactive.py |
Adds parametrized unit tests for the new context manager behavior. |
tests/unit/conftest.py |
Removes stray whitespace. |
tests/integration/test_containerd_integration.py |
Removes stray whitespace. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
233c46d to
ebb07ca
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
f669dd3 to
2926012
Compare
2926012 to
ed3a370
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Bug fix LP#2143365
#84 introduced a change where containerd is apt install even if the bin is replaced using a charm resource. That's fine, but the charm shouldn't restart containerd when its resource managed.
This change prevents service restarts of containerd when the binary is resource managed.