-
Notifications
You must be signed in to change notification settings - Fork 582
Add a function to compare the OS version #972
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
Conversation
@ekohl Your change is failing some syntax checks, just a quick fix needed:
Otherwise, looks good :) |
This function aims to reduce the boiler plate that a lot of modules have to compare versions: if $facts['operatingsystem'] == 'Ubuntu' && versioncmp(facts['operatingsystemmajrelease'], '16.04') >= 0 { Can now be reduced to: if os_version_gte('Ubuntu', '16.04') {
d91132b
to
4509b5c
Compare
@ekohl Unfortunately some random failures have appeared in the spec/functions/to_yaml_spec.rb test file when run on appveyor. They are unrelated to your change however I am unable to merge while they are there, so I won't be able to merge this in until they are dealt with. |
I'm in no hurry :) |
Also realized this will also need docs in README.md I guess. |
@ekohl The stdlib bug was fixed. If you could add some docs I will happily merge. |
@ekohl Hope you don't mind but I added some docs changes myself. If you're ok with them thenI can get this merged. |
Fixed a typo, but otherwise looks good. |
@ekohl ++ :) |
Thanks for the function |
The README.md says
but the unit tests and the actual implementation behave like this:
Debian 9 is the OS version, but running |
Hmm, you may be right. It would have been good to also test for Debian 10. I must admit I did not end up using this function myself. Could you provide a PR to better define the behavior and a bugfix if needed? |
As reported in <puppetlabs#972 (comment)>, os_version_gte is not returning correct results. This commit fixes the tests to demonstrate correct expected behavior.
As reported in <puppetlabs#972 (comment)>, os_version_gte is not returning correct results. This commit fixes the tests to demonstrate correct expected behavior.
As reported in <puppetlabs/puppetlabs-stdlib#972 (comment)>, os_version_gte is not returning correct results. This commit fixes the tests to demonstrate correct expected behavior.
This function aims to reduce the boiler plate that a lot of modules have
to compare versions:
Can now be reduced to:
Let the bikeshedding commence!