-
Notifications
You must be signed in to change notification settings - Fork 90
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
OpenSUSE Leap platform detection #377
Comments
I can see that Train's entire SUSE related detection is based around the existence of train/lib/train/platforms/detect/specifications/os.rb Lines 225 to 242 in 03afd4d
|
This also means SLES 15 won’t detect correctly. I’m fixing this on the Ohai side and I can fix it here if no one minds. |
@tas50 I've created a corresponding ohai issue yesterday: chef/ohai#1289 |
@tas50 Could you please fix this here? I also need this one :-) |
I think the regex is wrong. The file kitchen@b59935020e63:~> cat /etc/SuSE-release
NAME="openSUSE Leap"
VERSION="15.0"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.0"
PRETTY_NAME="openSUSE Leap 15.0"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.0"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/" Here the regex : version = suse.scan(/VERSION = (\d+)\nPATCHLEVEL = (\d+)/).flatten.join('.')
version = suse[/VERSION = ([\d\.]{2,})/, 1] if version == '' it waits for a white space before and after |
I'd suggest in the long run that train moves away from using files like /etc/SuSe-release and instead use /etc/os-release, which exists on every systemd based Linux distro and many distros prior to systemd. It has a standard format and can easily be combined with some case statements to make platform detection much more reliable. I made the switch in Ohai for Chef 15: chef/ohai#1299 |
@tas50 actually both file has same content : kitchen@b59935020e63:~> cat /etc/os-release
NAME="openSUSE Leap"
VERSION="15.0"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.0"
PRETTY_NAME="openSUSE Leap 15.0"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.0"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
kitchen@b59935020e63:~>
kitchen@b59935020e63:~>
kitchen@b59935020e63:~> cat /etc/SuSE-release
NAME="openSUSE Leap"
VERSION="15.0"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.0"
PRETTY_NAME="openSUSE Leap 15.0"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.0"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/" |
In this case they are the same, but moving to /etc/os-release as the main detection method allows us to skip a lot of the regex work and just perform some conversions on the ID field instead. That's what we do in ohai so we can remap opensuse-leap to opensuseleap for example. It eliminates dozens of brittle regexes across the different distro specific files. Prior to the os-release detecting platforms was pretty awful. |
Thanks for the enlightenment 👍 |
On a fresh installation this file should not exist - beginning with Leap 15 this file is missing on my systems. +1 on using /etc/os-release |
Description
A user reported an issue in which OpenSUSE Leap is not being detected.
Train and Platform Version
InSpec 3.0.12
Train 1.5.??
Target: OpenSUSE Leap 15 (Docker)
Replication Case
Extensive notes and repro instructions on the original issue, inspec/inspec#3574
Possible Solutions
Implement or refine SUSE detection
The text was updated successfully, but these errors were encountered: