Skip to content

Commit 38d3879

Browse files
committed
Use DNF for newer Enterprise Linux
Prior to this commit, the install_package and uninstall_package methods used Yum for all versions of Red Hat Enterprise Linux. However, RHEL has used DNF as its default package manager since version 8. This commit updates those methods to use DNF for RHEL 8, 9, and any future versions and to explicitly use Yum on RHEL versions 1-7.
1 parent b637031 commit 38d3879

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/beaker/host/unix/pkg.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ def install_package(name, cmdline_args = '', version = nil, opts = {})
8787
execute("zypper --non-interactive --gpg-auto-import-keys in #{name}", opts)
8888
when /el-4/
8989
@logger.debug("Package installation not supported on rhel4")
90-
when /amazon-2023|fedora-(2[2-9]|3[0-9])/
90+
when /amazon-2023|el-(8|9|1[0-9])|fedora-(2[2-9]|3[0-9])/
9191
name = "#{name}-#{version}" if version
9292
execute("dnf -y #{cmdline_args} install #{name}", opts)
93-
when /cisco|fedora|centos|redhat|eos|el-/
93+
when /cisco|fedora|centos|redhat|eos|el-[1-7]-/
9494
name = "#{name}-#{version}" if version
9595
execute("yum -y #{cmdline_args} install #{name}", opts)
9696
when /ubuntu|debian|cumulus|huaweios/
@@ -172,9 +172,9 @@ def uninstall_package(name, cmdline_args = '', opts = {})
172172
execute("zypper --non-interactive rm #{name}", opts)
173173
when /el-4/
174174
@logger.debug("Package uninstallation not supported on rhel4")
175-
when /amazon-2023|fedora-(2[2-9]|3[0-9])/
175+
when /amazon-2023|el-(8|9|1[0-9])|fedora-(2[2-9]|3[0-9])/
176176
execute("dnf -y #{cmdline_args} remove #{name}", opts)
177-
when /cisco|fedora|centos|redhat|eos|el-/
177+
when /cisco|fedora|centos|redhat|eos|el-[1-7]-/
178178
execute("yum -y #{cmdline_args} remove #{name}", opts)
179179
when /ubuntu|debian|cumulus|huaweios/
180180
execute("apt-get purge #{cmdline_args} -y #{name}", opts)

0 commit comments

Comments
 (0)