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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing distributions to the suse platform family #1047

Merged
merged 1 commit into from Mar 17, 2021

Conversation

m-terel
Copy link
Contributor

@m-terel m-terel commented Mar 16, 2021

We've found using gopsutil quite useful in open-source rport project. But we've encountered a problem of detecting a platform family for Linux opensuse-leap distribution. Here is an example of os-release file:

    NAME="openSUSE Leap"
    VERSION="15.2"
    ID="opensuse-leap"
    ID_LIKE="suse opensuse"
    VERSION_ID="15.2"
    PRETTY_NAME="openSUSE Leap 15.2"
    ANSI_COLOR="0;32"
    CPE_NAME="cpe:/o:opensuse:leap:15.2"
    BUG_REPORT_URL="https://bugs.opensuse.org"
    HOME_URL="https://www.opensuse.org/"

PlatformInformationWithContext detects platform family by ID attribute. Since "opensuse-leap" is missing in the switch statement, it returns an empty string for family. This PR fixes this issue.

Also, according to https://en.opensuse.org/SDB:SUSE_and_openSUSE_Products_Version_Outputs there are other distributions: "opensuse-tumbleweed", "opensuse-tumbleweed-kubic", "sled", "caasp". This PR fixes the issue for all missing distributions.

BTW, if you like our project https://github.com/cloudradar-monitoring/rport - please give us a star馃檪

@shirou
Copy link
Owner

shirou commented Mar 17, 2021

confirmed on openSUSE Leap 15.2.

=== RUN   TestPlatformInformation
    host_test.go:191: PlatformInformation(): opensuse-leap, suse, 15.2

Thank you so much!

@shirou shirou merged commit 59c1f43 into shirou:master Mar 17, 2021
@Lomanic
Copy link
Collaborator

Lomanic commented Mar 17, 2021

This is missing the same fix in v3

shirou added a commit that referenced this pull request Mar 17, 2021
Lomanic added a commit that referenced this pull request Mar 19, 2021
[v3][host][linux] add suse to v3 following #1047
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants