Skip to content

Commit

Permalink
Use RpmPackage on CentOS and Fedora and not only on CentOS
Browse files Browse the repository at this point in the history
On Fedora you can also install dpkg, which will cause testinfra to think that
the package manager is actually DPKG and not RPM. Thus we instead use the
system_info.distribution value to prefer rpm on Fedora
  • Loading branch information
dcermak authored and philpep committed Nov 4, 2021
1 parent a276c11 commit 1133428
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions testinfra/modules/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,12 @@ def get_module_class(cls, host):
return OpenBSDPackage
if host.system_info.distribution in ("debian", "ubuntu"):
return DebianPackage
if (
host.system_info.distribution
and host.system_info.distribution.lower() == "centos"
if host.system_info.distribution and (
host.system_info.distribution.lower()
in (
"centos",
"fedora",
)
):
return RpmPackage
if host.system_info.distribution == "arch":
Expand Down

0 comments on commit 1133428

Please sign in to comment.