Skip to content

Feature: [Ubuntu, no-CVM] Adding reboot, hibernate checks and aligning all pre-reqs together#363

Merged
rane-rajasi merged 5 commits into
masterfrom
rarane/certupdate/canonical_specialcases
Jul 13, 2026
Merged

Feature: [Ubuntu, no-CVM] Adding reboot, hibernate checks and aligning all pre-reqs together#363
rane-rajasi merged 5 commits into
masterfrom
rarane/certupdate/canonical_specialcases

Conversation

@rane-rajasi

@rane-rajasi rane-rajasi commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

This PR defines all pre-requisites for updating certificates in Canonical VMs, some of which were already existing and are now re-aligned in appropriate sections and some are added as new.

The pre-reqs for certificate updates are:

  1. Should not be a CVM
  2. Hibernation should be turned off. If it is enabled, we report an error and do not update any certificates
  3. Should not contain latest certificates already
  4. System uptime should not be more than 7 days, if it is, we issue a reboot if permitted"""

This change also introduces a parent package manager flag, is_certificate_update_enabled_for_package_manager, which can be overridden by individual distro package managers as certificate update support is added.

In-VM Test logs:

@rane-rajasi
rane-rajasi requested review from a team, kjohn-msft, michellemcdaniel and najams and removed request for a team July 10, 2026 22:43
@rane-rajasi
rane-rajasi requested a review from kjohn-msft as a code owner July 10, 2026 22:43
@rane-rajasi
rane-rajasi requested a review from najams as a code owner July 10, 2026 22:43
@rane-rajasi
rane-rajasi requested review from vbonu16 and yashnap July 10, 2026 22:43
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.41036% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.03%. Comparing base (81ec7e5) to head (2bf567a).

Files with missing lines Patch % Lines
...rc/core/src/package_managers/Dnf5PackageManager.py 50.00% 2 Missing ⚠️
src/core/src/package_managers/PackageManager.py 92.30% 2 Missing ⚠️
...rc/core/src/package_managers/TdnfPackageManager.py 50.00% 2 Missing ⚠️
src/core/src/package_managers/YumPackageManager.py 50.00% 2 Missing ⚠️
.../core/src/package_managers/ZypperPackageManager.py 50.00% 2 Missing ⚠️
src/core/tests/Test_AptitudePackageManager.py 98.90% 2 Missing ⚠️
src/core/tests/Test_PatchInstaller.py 99.37% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #363      +/-   ##
==========================================
- Coverage   94.08%   94.03%   -0.06%     
==========================================
  Files         109      109              
  Lines       20099    20348     +249     
==========================================
+ Hits        18911    19134     +223     
- Misses       1188     1214      +26     
Flag Coverage Δ
python27 94.03% <97.41%> (-0.06%) ⬇️
python312 94.03% <97.41%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI 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.

Pull request overview

This PR extends the UEFI certificate update flow (used during default patching) by enforcing additional pre-requisites (CVM exclusion, hibernation-off, latest-certs check, and uptime-based reboot handling) and updating unit tests accordingly.

Changes:

  • Adds prerequisite gating in PatchInstaller before attempting UEFI certificate updates, including reboot/hibernate/latest-certs checks.
  • Adds Apt-specific implementations for uptime and hibernation detection to support the new prerequisites.
  • Expands test coverage to validate prerequisite branching and status/error recording behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/core/src/core_logic/PatchInstaller.py Adds certificate-update prerequisite checks and records status/errors for prerequisite failures and update failures.
src/core/src/package_managers/AptitudePackageManager.py Implements uptime-based reboot check and hibernation-state detection for cert-update prerequisites.
src/core/src/package_managers/PackageManager.py Refactors certificate update entrypoints and adds shared mokutil availability gating for cert checks.
src/core/src/package_managers/YumPackageManager.py Adds stub implementations for new certificate prerequisite APIs.
src/core/src/package_managers/TdnfPackageManager.py Adds stub implementations for new certificate prerequisite APIs.
src/core/src/package_managers/ZypperPackageManager.py Adds stub implementations for new certificate prerequisite APIs.
src/core/src/package_managers/Dnf5PackageManager.py Adds stub implementations for new certificate prerequisite APIs.
src/core/tests/Test_PatchInstaller.py Adds/updates tests to validate prerequisite ordering and installation-status error recording.
src/core/tests/Test_AptitudePackageManager.py Adds/updates tests for mokutil/cert-check behavior and uptime-based reboot decisioning.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/core/src/package_managers/PackageManager.py Outdated
Comment thread src/core/src/package_managers/PackageManager.py Outdated
Comment thread src/core/src/package_managers/AptitudePackageManager.py Outdated
Comment thread src/core/src/package_managers/YumPackageManager.py
Comment thread src/core/src/package_managers/TdnfPackageManager.py
Comment thread src/core/src/package_managers/ZypperPackageManager.py
Comment thread src/core/src/package_managers/Dnf5PackageManager.py
Comment thread src/core/src/core_logic/PatchInstaller.py
Comment thread src/core/src/package_managers/AptitudePackageManager.py Outdated
Comment thread src/core/src/package_managers/AptitudePackageManager.py Outdated
Comment thread src/core/src/core_logic/PatchInstaller.py

@kjohn-msft kjohn-msft 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.

Review code coverage + minor comments

Comment thread src/core/src/package_managers/AptitudePackageManager.py Outdated
@kjohn-msft kjohn-msft added the feature New feature or request label Jul 10, 2026
Comment thread src/core/tests/Test_AptitudePackageManager.py Fixed
Comment thread src/core/tests/Test_AptitudePackageManager.py Fixed
Comment thread src/core/tests/Test_AptitudePackageManager.py Fixed
Comment thread src/core/tests/Test_AptitudePackageManager.py Fixed
Comment thread src/core/tests/Test_AptitudePackageManager.py Fixed
Comment thread src/core/tests/Test_AptitudePackageManager.py Fixed
Comment thread src/core/tests/Test_AptitudePackageManager.py Fixed
Comment thread src/core/tests/Test_AptitudePackageManager.py Fixed
Comment thread src/core/tests/Test_AptitudePackageManager.py Fixed
Comment thread src/core/tests/Test_AptitudePackageManager.py Fixed
@rane-rajasi
rane-rajasi merged commit 50cc82b into master Jul 13, 2026
9 checks passed
@rane-rajasi
rane-rajasi deleted the rarane/certupdate/canonical_specialcases branch July 13, 2026 16:05
@rane-rajasi rane-rajasi mentioned this pull request Jul 14, 2026
kjohn-msft pushed a commit that referenced this pull request Jul 14, 2026
This release contains:

- Feature: [Ubuntu, no-CVM] Change opt-in logic to update certificates
for Ubuntu [364](#364)
- Feature: [Ubuntu, no-CVM] Adding reboot, hibernate checks and aligning
all pre-reqs together
[363](#363)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants