Skip to content

Feature: Adding Azure Linux 4.0 Base Support using dnf5 package manager#343

Open
yashnap wants to merge 8 commits into
masterfrom
37454066_dnf5_packageManager_support
Open

Feature: Adding Azure Linux 4.0 Base Support using dnf5 package manager#343
yashnap wants to merge 8 commits into
masterfrom
37454066_dnf5_packageManager_support

Conversation

@yashnap
Copy link
Copy Markdown
Contributor

@yashnap yashnap commented May 11, 2026

Implemented DnfPackageManager by extending PackageManager instead of TdnfPackageManager.
DNF5 behavior (output, classification, dependency resolution) differs from Tdnf making reuse unsafe. This approach keeps the implementation clean with dnf5 capabilities.

  • Added ConfigurationFactory, EnvLayer and Constants change needed across the board for all operations

FIRST ITERATION ( Enablement/Disablement)

  • Added changes to support detection, enablement and disablement.

Implemented the below methods:

  • get_current_auto_os_patch_state,

  • disable_auto_os_update,

  • disable_auto_os_update_for_dnf5_automatic,

  • disable_auto_update_on_reboot,

  • is_auto_update_service_installed,

  • is_service_set_to_enable_on_reboot,

  • enable_auto_update_on_reboot

  • Added few UT's to cover the implementation(more to follow)

TESTING

  • Tested it on Linux 4 VM by creating a helper script to detect, disable and enable OS update using dnf5-automatic

ARM ID : /subscriptions/6acc8a91-e2b0-4041-a069-c2932ab42fd9/resourceGroups/rg-yashna-linux4-test-wus2/providers/Microsoft.Compute/virtualMachines/vm-yashna-linux4

Enablement_Disablement

<--------------------ITERATION2------------------------->

  • Automatic assessment (configuring, running, reporting, disablement)

output.txt

Copilot AI review requested due to automatic review settings May 11, 2026 20:48
@yashnap yashnap force-pushed the 37454066_dnf5_packageManager_support branch from 7ddf13b to c615038 Compare May 11, 2026 20:52
Copy link
Copy Markdown
Contributor

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

Note

Copilot was unable to run its full agentic suite in this review.

Introduces an Azure Linux 4–specific DNF (dnf5) package manager implementation and wires it into distro/package-manager detection so Azure Linux 4 selects DNF instead of TDNF.

Changes:

  • Added AzL4DnfPackageManager skeleton class extending PackageManager.
  • Updated Azure Linux package manager detection to choose DNF for Azure Linux 4+ and TDNF for Azure Linux 3.
  • Added Constants.DNF and registered DNF configurations in ConfigurationFactory.

Reviewed changes

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

File Description
src/core/src/package_managers/AzL4DnfPackageManager.py Adds a new (currently stubbed) DNF-based package manager for Azure Linux 4.
src/core/src/bootstrap/EnvLayer.py Selects DNF for Azure Linux 4+ and keeps TDNF for Azure Linux 3.
src/core/src/bootstrap/Constants.py Introduces a DNF constant used by configuration selection.
src/core/src/bootstrap/ConfigurationFactory.py Registers DNF configs and maps them to AzL4DnfPackageManager.
Comments suppressed due to low confidence (1)

src/core/src/bootstrap/EnvLayer.py:1

  • This error path drops useful diagnostics. Consider including the command result (out) and/or the checked path in the message so failures are actionable (e.g., when dnf is installed but not on PATH). Also, returning str() (empty string) makes it hard to distinguish 'not found' vs 'unknown'; consider returning None or a dedicated sentinel, depending on existing conventions in this module.
# Copyright 2020 Microsoft Corporation

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

Comment on lines +34 to +40
def refresh_repo(self):
"""Refreshes the DNF repository cache and lists available updates by cleaning expired cache entries
Commands:
- sudo dnf clean expire-cache (cleans expired cache entries)
- sudo dnf -q check-update (checks for available updates)
"""
pass
Comment on lines +54 to +76
def get_all_updates(self, cached=False):
"""Gets all missing updates available for the system and returns the cached updates list and versions list
Cache Check Logic:
- If cached=True and cache has data, return cached updates and versions immediately (high performance reuse)
- If cache miss or cached=False, execute the DNF command to get fresh updates and populate cache
Command:
- sudo dnf -q check-update (checks for all available updates)
1. If cached=True and cache has data, return cached results
2. Execute command, parse output, cache results
3. Return all_updates_cached and all_update_versions_cached
"""
return [], []

# AssessPatch method
def get_security_updates(self):
"""Gets all missing security updates available for the system and returns packages and versions list
Command:
- sudo dnf -q check-update --security (checks for available security updates only)
Returns:
- List of security package names
- List of corresponding security package versions
"""
pass
Comment thread src/core/src/bootstrap/EnvLayer.py Outdated
if major is not None and int(major) >= 4:
code, out = self.run_command_output('which dnf', False, False)
if code == 0:
return 'dnf'
"""
return [], []

def set_max_patch_publish_date(self, max_patch_publish_date=str()):
@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

❌ Patch coverage is 74.29577% with 73 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.54%. Comparing base (6f0af88) to head (ae2ba12).

Files with missing lines Patch % Lines
src/core/src/package_managers/DnfPackageManager.py 68.99% 71 Missing ⚠️
src/core/tests/Test_DnfPackageManager.py 96.15% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #343      +/-   ##
==========================================
- Coverage   93.84%   93.54%   -0.30%     
==========================================
  Files         105      107       +2     
  Lines       18218    18501     +283     
==========================================
+ Hits        17096    17307     +211     
- Misses       1122     1194      +72     
Flag Coverage Δ
python27 93.54% <74.29%> (-0.30%) ⬇️
python312 93.54% <74.29%> (-0.30%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

@yashnap yashnap force-pushed the 37454066_dnf5_packageManager_support branch from b081d06 to 1b80cf7 Compare May 19, 2026 17:33
Comment thread src/core/src/package_managers/DnfPackageManager.py Fixed
Comment thread src/core/tests/Test_DnfPackageManager.py Fixed
Comment thread src/core/tests/Test_DnfPackageManager.py Fixed
@yashnap yashnap force-pushed the 37454066_dnf5_packageManager_support branch from 0a05123 to 9b9fd31 Compare May 20, 2026 18:43
@yashnap yashnap changed the title Skeleton PR for dnf5 linux4 implementation Feature: Adding Azure Linux 4.0 Base Support using dnf5 package manager May 20, 2026
@yashnap yashnap force-pushed the 37454066_dnf5_packageManager_support branch from 6fdc513 to d42304e Compare May 21, 2026 22:41
@yashnap yashnap force-pushed the 37454066_dnf5_packageManager_support branch from d42304e to b950de5 Compare May 21, 2026 22:42
self.install_check_cmd = self.dnf5_automatic_install_check_cmd
self.current_auto_os_update_service = self.dnf5_auto_os_update_service

def __get_current_auto_os_updates_setting_on_machine(self):
def test_refresh_repo(self):
self.runtime.set_legacy_test_type('HappyPath')
package_manager = self.container.get('package_manager')
self.assertTrue(package_manager is not None)
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.

2 participants