-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add version comparison functionality for package_version #169
Add version comparison functionality for package_version #169
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see some redundant call to get the version of the package.
PD: I wouldn't add not related changes to the PR
f58a2b6
to
ddcb758
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @rtorrero
* Add version comparison functionality for package_version
This PR allows the
package_version
gatherer to be used to compare versions on the agent. This way, we can handle the complexity of comparing RPM package version strings to the OS usingzypper versioncmp
(seezypper versioncmp --help
for more details).Notice that this just adds to the existing functionality of requesting package version strings which should still work as it previously did. To request a version comparison, a package name together with a version string needs to be provided in the argument, separated by a coma (
,
).The returned value for such requests is a FactValueInt, containing:
0
if the provided version string matches the installed package version for the requested package-1
if the provided version string is older that what's currently installed.1
if the provided version string is newer than what's currently installed.Example on how to collect such facts:
For such requests, the returned values should look like:
Notice how the first fact request asks for
corosync
against2.4.5
, which will cause that an integer instead of a regularFactValueString
with a version string. The second one, as it just asks for a package name will return a version string as it did before.