Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions base/comps/sos/dnf-initial-dnf5-support-in-dnf-plugin.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
From b8ba38e844c085abefca44b1b11b9522a18b8fa2 Mon Sep 17 00:00:00 2001
From: Eric Desrochers <eric.desrochers@microsoft.com>
Date: Fri, 24 Apr 2026 14:55:28 +0000
Subject: [PATCH] [dnf] initial dnf5 support in dnf plugin

Handling DNF5 changes where legacy dnf commands produce
Missing command or Unknown argument errors, while
preserving existing dnf support unchanged.

https://dnf5.readthedocs.io/en/latest/changes_from_dnf4.7.html

Closes: #4308

Signed-off-by: Eric Desrochers <eric.desrochers@microsoft.com>
---
sos/report/plugins/dnf.py | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/sos/report/plugins/dnf.py b/sos/report/plugins/dnf.py
index d79d58c3..eebaabd9 100644
--- a/sos/report/plugins/dnf.py
+++ b/sos/report/plugins/dnf.py
@@ -30,7 +30,7 @@ class DNFPlugin(Plugin, RedHatPlugin):
profiles = ('system', 'packagemanager', 'sysmgmt')

files = ('/etc/dnf/dnf.conf',)
- packages = ('dnf',)
+ packages = ('dnf', 'dnf5')

option_list = [
PluginOpt('history-info', default=False,
@@ -51,6 +51,7 @@ class DNFPlugin(Plugin, RedHatPlugin):
tags='dnf_module_info')

def setup(self):
+ has_dnf5 = self.is_installed('dnf5')

self.add_file_tags({
'/etc/dnf/modules.d/.*.module': 'dnf_modules'
@@ -90,7 +91,10 @@ class DNFPlugin(Plugin, RedHatPlugin):
self.add_cmd_output('dnf -C repolist',
tags=['yum_repolist', 'dnf_repolist'])
Comment on lines +41 to +42

- self.add_cmd_output('dnf -C repolist --verbose')
+ if has_dnf5:
+ self.add_cmd_output('dnf repo info')
+ else:
+ self.add_cmd_output('dnf -C repolist --verbose')

self.add_forbidden_path([
"/etc/pki/entitlement/key.pem",
@@ -103,11 +107,11 @@ class DNFPlugin(Plugin, RedHatPlugin):
"/etc/pki/entitlement/*.pem"
])

+ cmd = f"dnf history {'list' if self.is_installed('dnf5') else ''}"
if not self.get_option("history-info"):
- self.add_cmd_output("dnf history", tags='dnf_history')
+ self.add_cmd_output(cmd, tags='dnf_history')
else:
- history = self.collect_cmd_output("dnf history",
- tags='dnf_history')
+ history = self.collect_cmd_output(cmd, tags='dnf_history')
transactions = -1
if history['output']:
for line in history['output'].splitlines():
@@ -122,10 +126,11 @@ class DNFPlugin(Plugin, RedHatPlugin):
subdir="history-info",
tags='dnf_history_info')

- # Get list of dnf installed modules and their details.
- module_cmd = "dnf module list --installed"
- modules = self.collect_cmd_output(module_cmd)
- self.get_modules_info(modules['output'])
+ if not has_dnf5:
+ # Get list of dnf installed modules and their details.
+ module_cmd = "dnf module list --installed"
+ modules = self.collect_cmd_output(module_cmd)
+ self.get_modules_info(modules['output'])

def postproc(self):
# Scrub passwords in repositories and yum/dnf variables
--
2.45.2

6 changes: 6 additions & 0 deletions base/comps/sos/sos.comp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ description = "Add os_release_id value to match os-release ID"
type = "patch-add"
file = "Policy-Add-os_release_id-check.patch"
source = "Policy-Add-os_release_id-check.patch"

[[components.sos.overlays]]
description = "Add dnf5 support in dnf plugin"
type = "patch-add"
file = "dnf-initial-dnf5-support-in-dnf-plugin.patch"
source = "dnf-initial-dnf5-support-in-dnf-plugin.patch"
2 changes: 1 addition & 1 deletion locks/sos.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
version = 1
import-commit = 'f3ecbda85d52c61c5c80ee3fe5c2a31886f040c6'
upstream-commit = 'f3ecbda85d52c61c5c80ee3fe5c2a31886f040c6'
input-fingerprint = 'sha256:833766ffc4e275c5f663b1acd76e75c5913ba1376473705699a3e53f86939227'
input-fingerprint = 'sha256:1b42adf08dbd0b006ff58d7a4611fc635e5882109af8ff410796fbf6ca211e3b'
resolution-input-hash = 'sha256:466421704711c4fd3c71f0b2ed715a0e61d49e3e26f3a2637fee755795849c8e'
85 changes: 85 additions & 0 deletions specs/s/sos/dnf-initial-dnf5-support-in-dnf-plugin.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
From b8ba38e844c085abefca44b1b11b9522a18b8fa2 Mon Sep 17 00:00:00 2001
From: Eric Desrochers <eric.desrochers@microsoft.com>
Date: Fri, 24 Apr 2026 14:55:28 +0000
Subject: [PATCH] [dnf] initial dnf5 support in dnf plugin

Handling DNF5 changes where legacy dnf commands produce
Missing command or Unknown argument errors, while
preserving existing dnf support unchanged.

https://dnf5.readthedocs.io/en/latest/changes_from_dnf4.7.html

Closes: #4308

Signed-off-by: Eric Desrochers <eric.desrochers@microsoft.com>
---
sos/report/plugins/dnf.py | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/sos/report/plugins/dnf.py b/sos/report/plugins/dnf.py
index d79d58c3..eebaabd9 100644
--- a/sos/report/plugins/dnf.py
+++ b/sos/report/plugins/dnf.py
@@ -30,7 +30,7 @@ class DNFPlugin(Plugin, RedHatPlugin):
profiles = ('system', 'packagemanager', 'sysmgmt')

files = ('/etc/dnf/dnf.conf',)
- packages = ('dnf',)
+ packages = ('dnf', 'dnf5')

option_list = [
PluginOpt('history-info', default=False,
@@ -51,6 +51,7 @@ class DNFPlugin(Plugin, RedHatPlugin):
tags='dnf_module_info')

def setup(self):
+ has_dnf5 = self.is_installed('dnf5')

self.add_file_tags({
'/etc/dnf/modules.d/.*.module': 'dnf_modules'
@@ -90,7 +91,10 @@ class DNFPlugin(Plugin, RedHatPlugin):
self.add_cmd_output('dnf -C repolist',
tags=['yum_repolist', 'dnf_repolist'])

- self.add_cmd_output('dnf -C repolist --verbose')
+ if has_dnf5:
+ self.add_cmd_output('dnf repo info')
+ else:
+ self.add_cmd_output('dnf -C repolist --verbose')

self.add_forbidden_path([
"/etc/pki/entitlement/key.pem",
@@ -103,11 +107,11 @@ class DNFPlugin(Plugin, RedHatPlugin):
"/etc/pki/entitlement/*.pem"
])

+ cmd = f"dnf history {'list' if self.is_installed('dnf5') else ''}"
if not self.get_option("history-info"):
- self.add_cmd_output("dnf history", tags='dnf_history')
+ self.add_cmd_output(cmd, tags='dnf_history')
else:
- history = self.collect_cmd_output("dnf history",
- tags='dnf_history')
+ history = self.collect_cmd_output(cmd, tags='dnf_history')
transactions = -1
if history['output']:
for line in history['output'].splitlines():
@@ -122,10 +126,11 @@ class DNFPlugin(Plugin, RedHatPlugin):
subdir="history-info",
tags='dnf_history_info')

- # Get list of dnf installed modules and their details.
- module_cmd = "dnf module list --installed"
- modules = self.collect_cmd_output(module_cmd)
- self.get_modules_info(modules['output'])
+ if not has_dnf5:
+ # Get list of dnf installed modules and their details.
+ module_cmd = "dnf module list --installed"
+ modules = self.collect_cmd_output(module_cmd)
+ self.get_modules_info(modules['output'])

def postproc(self):
# Scrub passwords in repositories and yum/dnf variables
--
2.45.2

6 changes: 5 additions & 1 deletion specs/s/sos/sos.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## (rpmautospec version 0.8.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = 2;
release_number = 3;
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
Expand Down Expand Up @@ -44,6 +44,7 @@ BuildRequires: fdupes

Patch0: Policy-Fix-os_release_name-value.patch
Patch1: Policy-Add-os_release_id-check.patch
Patch2: dnf-initial-dnf5-support-in-dnf-plugin.patch
%description
Sos is a set of tools that gathers information about system
hardware and configuration. The information can then be used for
Expand Down Expand Up @@ -118,6 +119,9 @@ rm -rf %{buildroot}/usr/config/

%changelog
## START: Generated by rpmautospec
* Thu May 07 2026 Eric Desrochers <eric.desrochers@microsoft.com> - 4.11.0-3
- fix(sos): add dnf5 support in dnf plugin

* Thu Apr 30 2026 Daniel McIlvaney <damcilva@microsoft.com> - 4.11.0-2
- feat: introduce deterministic commit resolution via Azure Linux lock file

Expand Down
Loading