-
Notifications
You must be signed in to change notification settings - Fork 91
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
Enhance OS version parsing to handle SUSE SP notation #248
Conversation
…ats and SUSE-specific SP notation for minor versions.
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.
looks good (not that anybody can read regex)
That also means the maintainability of the regex will suffer. I would like to see another revision where the code is modified to have a separate regex for suse. I think is will be more readable and better to maintain. Then either we try each regex to see which one matches OR we use the ID_LIKE="suse" to choose the right regex to apply. |
Use extractVersionDetails method
Totally agreed. Updated with slight changes. |
@andrewkroh |
Co-authored-by: Andrew Kroh <[email protected]>
Description
This PR enhances the
versionGrok
regex pattern within makeOSInfo to support SUSE Linux Enterprise Server (SLES) versions that useSP
notation for Service Packs, such as15-SP5
.The updated regex now recognizes
SP
as a valid separator for the minor version, allowing accurate parsing of SLES versions alongside standard major.minor.patch formats (e.g.,22.04
). This change resolves issues where Minor was incorrectly set to0
forSP
-based versions and ensures compatibility with both SUSE-specific and conventional version formats.Changes
Updated
versionGrok
regex: Added optional SP notation support as a prefix for the minor version.Compatibility maintained: Supports both
.
and-
delimiters to handle multiple versioning schemes.Testing
Test cases added: Included tests for both
SLES 15-SP5
andSLED 15-SP5
to validate correct assignment of major, minor, and patch values.