Skip to content

[LP#2143365] When containerd is installed by resource, don't restart service with apt#98

Open
addyess wants to merge 3 commits intomainfrom
bug/lp2143365/dont_always_restart_containerd
Open

[LP#2143365] When containerd is installed by resource, don't restart service with apt#98
addyess wants to merge 3 commits intomainfrom
bug/lp2143365/dont_always_restart_containerd

Conversation

@addyess
Copy link
Member

@addyess addyess commented Mar 6, 2026

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.

Copilot AI review requested due to automatic review settings March 6, 2026 04:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 during apt_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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@addyess addyess force-pushed the bug/lp2143365/dont_always_restart_containerd branch from 233c46d to ebb07ca Compare March 6, 2026 15:48
@addyess addyess requested a review from Copilot March 6, 2026 17:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@addyess addyess force-pushed the bug/lp2143365/dont_always_restart_containerd branch from f669dd3 to 2926012 Compare March 6, 2026 17:41
@addyess addyess force-pushed the bug/lp2143365/dont_always_restart_containerd branch from 2926012 to ed3a370 Compare March 6, 2026 17:42
@addyess addyess requested a review from Copilot March 6, 2026 17:43
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants