From ba882b8fa10211789999ee02abed146484676050 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Thu, 11 Jun 2026 14:27:59 +0200 Subject: [PATCH] t/g/u/test_xen_guest_agent.py: Use yum on older distros or dnf if available On some modern systems that uses dnf, there is a compatibility yum wrapper. dnf5-5.2.18.0-4.fc43.x86_64 contains /sbin/yum But not available in all dnf systems dnf-4.20.0-14.el10_0.alma.1.noarch only contains /usr/bin/dnf So we have to support both. Some refactoring can be considered to support more package managers. Observed issue was: tests/guest_tools/unix/test_xen_guest_agent.py::TestXenGuestAgent::test_agent_running_after_reboot[...] lib.commands.SSHCommandFailed: SSH command (dnf install -y xen-guest-agent) failed with return code 127: bash: dnf: command not found Related-to: https://github.com/xcp-ng/xcp-ng-tests/pull/434/changes#r3395851769 Signed-off-by: Philippe Coval --- tests/guest_tools/unix/test_xen_guest_agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/guest_tools/unix/test_xen_guest_agent.py b/tests/guest_tools/unix/test_xen_guest_agent.py index c82004c8a..3392cd543 100644 --- a/tests/guest_tools/unix/test_xen_guest_agent.py +++ b/tests/guest_tools/unix/test_xen_guest_agent.py @@ -53,7 +53,7 @@ def agent_install(self, running_vm: VM, xen_guest_agent_urls: dict[str, str]) -> rpm_repo = xen_guest_agent_urls['rpm_repo'] vm.ssh(f"echo -e '[xen-guest-agent]\\nbaseurl={rpm_repo}main/\\ngpgcheck=0'" f" > /etc/yum.repos.d/xen-guest-agent.repo") - vm.ssh('dnf install -y xen-guest-agent') + vm.ssh('app=yum && which dnf && app=dnf ; $app install -y xen-guest-agent') elif pkg_mgr == PackageManagerEnum.APT_GET: # DEB packages are published to a stable APT repo in the GitLab # Generic Package Registry after each push to main.