Feature: Adding Azure Linux 4.0 Base Support using dnf5 package manager#343
Feature: Adding Azure Linux 4.0 Base Support using dnf5 package manager#343yashnap wants to merge 8 commits into
Conversation
7ddf13b to
c615038
Compare
There was a problem hiding this comment.
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
AzL4DnfPackageManagerskeleton class extendingPackageManager. - Updated Azure Linux package manager detection to choose DNF for Azure Linux 4+ and TDNF for Azure Linux 3.
- Added
Constants.DNFand registered DNF configurations inConfigurationFactory.
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., whendnfis installed but not on PATH). Also, returningstr()(empty string) makes it hard to distinguish 'not found' vs 'unknown'; consider returningNoneor 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.
| 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 |
| 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 |
| 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 Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b081d06 to
1b80cf7
Compare
0a05123 to
9b9fd31
Compare
6fdc513 to
d42304e
Compare
d42304e to
b950de5
Compare
| 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) |
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.
FIRST ITERATION ( Enablement/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
ARM ID : /subscriptions/6acc8a91-e2b0-4041-a069-c2932ab42fd9/resourceGroups/rg-yashna-linux4-test-wus2/providers/Microsoft.Compute/virtualMachines/vm-yashna-linux4
<--------------------ITERATION2------------------------->
output.txt