Skip to content
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

fix to parse Family fileds in OSInfo struct correctly for openSUSE #146

Merged
merged 3 commits into from
Jan 18, 2023

Conversation

topazus
Copy link
Contributor

@topazus topazus commented Jan 11, 2023

In openSUSE Leap and openSUSE Tumbleweed that belong to suse family, the values of Platform filed in OSInfo struct are respectively opensuse-leap and opensuse-tumbleweed. so we need to add these two values to the specific location of familyMap.

var familyMap = map[string][]string{
"redhat": {"redhat", "fedora", "centos", "scientific", "oraclelinux", "ol",
"amzn", "rhel", "almalinux", "openeuler", "rocky"},
"debian": {"debian", "ubuntu", "raspbian", "linuxmint"},
"suse": {"suse", "sles", "opensuse"},
}
var platformToFamilyMap map[string]string
func init() {
platformToFamilyMap = map[string]string{}
for family, platformList := range familyMap {
for _, platform := range platformList {
platformToFamilyMap[platform] = family
}
}
}

os.Family = platformToFamilyMap[strings.ToLower(os.Platform)]

@elasticmachine
Copy link
Collaborator

elasticmachine commented Jan 11, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-01-18T14:18:58.401+0000

  • Duration: 9 min 45 sec

Test stats 🧪

Test Results
Failed 0
Passed 236
Skipped 4
Total 240

@andrewkroh
Copy link
Member

/test

@topazus
Copy link
Contributor Author

topazus commented Jan 15, 2023

@andrewkroh Thanks for your approval for the test.

Use VERSION_ID if VERSION is not found in the os-release metadata.
Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I added version parsing for the opensuse-tumbleweed. It only had a VERSION_ID field and it wasn't being read.

@andrewkroh andrewkroh merged commit 2841c12 into elastic:main Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants