[FEATURE REQUEST] Include accurate package version comparison for RHEL7
See original GitHub issueIs your feature request related to a problem? Please describe.
The pkg.version_cmp
module using Salt’s built-in comparison is not always accurate on RedHat-derived machines; there is a helpful warning message to this effect when using the CLI. However, when using external UI-driven products that depend on pkg.version_cmp
, inaccurate version comparions can cause unexpected failures. Since, on RHEL7, the accurate comparison depends on the python3-rpm
package from EPEL, users may not have this out of the box, and adding EPEL may have obstacles depending on their environment.
One comparison example (from libxml2
versions):
[root@rhel7 vagrant]# salt-call pkg.version_cmp '2.9.1-6.el7_2.3' '2.9.1-6.el7.4'
[WARNING ] Please install a package that provides rpm.labelCompare for more accurate version comparisons.
[WARNING ] Falling back on salt.utils.versions.version_cmp() for version comparisons
local:
1
[root@rhel7 vagrant]# yum -y -q install python3-rpm
[root@rhel7 vagrant]# salt-call pkg.version_cmp '2.9.1-6.el7_2.3' '2.9.1-6.el7.4'
local:
-1
Describe the solution you’d like
I spoke at length with @dmurphy18 on Slack, and doing the comparison by shelling out to rpmdev-vercmp
, which is part of the base OS’s rpmdevtools
, would be the preferred solution. I believe the implication is that the installation of salt packages should depend on rpmdevtools
.
Describe alternatives you’ve considered
- Adding
python3-rpm
to Saltstack’s repo and making it a dependency. - No change. External tools using
pkg.version_cmp
responsible for documenting installation ofpython3-rpm
from EPEL to obtain working functionality.
Issue Analytics
- State:
- Created 3 years ago
- Comments:23 (19 by maintainers)
This is also seems to work correctly for me on RHEL7 and CentOS7 for the 3002rc1 package.
This seems to be working correctly on Amazon Linux 2 using the 3002rc1 package.
There is no RHEL 7 package for 3002rc1, so will check again once RHEL 7 for 3002 is built.