facts: suse: fix SLES4SAP12 detection (#44388)

This commit is contained in:
Lars 2018-11-06 14:12:38 +01:00 committed by ansibot
parent d5a4a401ea
commit b6b238ae43
2 changed files with 62 additions and 1 deletions

View file

@ -269,6 +269,10 @@ class DistributionFiles:
else: else:
release = "0" # no minor number, so it is the first release release = "0" # no minor number, so it is the first release
suse_facts['distribution_release'] = release suse_facts['distribution_release'] = release
# Starting with SLES4SAP12 SP3 NAME reports 'SLES' instead of 'SLES_SAP'
# According to SuSe Support (SR101182877871) we should use the CPE_NAME to detect SLES4SAP
if re.search("^CPE_NAME=.*sles_sap.*$", line):
suse_facts['distribution'] = 'SLES_SAP'
elif path == '/etc/SuSE-release': elif path == '/etc/SuSE-release':
if 'open' in data.lower(): if 'open' in data.lower():
data = data.splitlines() data = data.splitlines()

View file

@ -351,7 +351,64 @@ CPE_NAME="cpe:/o:suse:sles:12:sp1"
"distribution_version": "12.1", "distribution_version": "12.1",
} }
}, },
{
"name": "SLES4SAP 12 SP2",
"input": {
"/etc/SuSE-release": """
SUSE Linux Enterprise Server 12 (x86_64)
VERSION = 12
PATCHLEVEL = 2
# This file is deprecated and will be removed in a future service pack or release.
# Please check /etc/os-release for details about this release.
""",
"/etc/os-release": """
NAME="SLES_SAP"
VERSION="12-SP2"
VERSION_ID="12.2"
PRETTY_NAME="SUSE Linux Enterprise Server for SAP Applications 12 SP2"
ID="sles_sap"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles_sap:12:sp2"
""",
},
"platform.dist": ['SuSE', '12', 'x86_64'],
"result":{
"distribution": "SLES_SAP",
"distribution_major_version": "12",
"distribution_release": "2",
"os_family": "Suse",
"distribution_version": "12.2",
}
},
{
"name": "SLES4SAP 12 SP3",
"input": {
"/etc/SuSE-release": """
SUSE Linux Enterprise Server 12 (x86_64)
VERSION = 12
PATCHLEVEL = 3
# This file is deprecated and will be removed in a future service pack or release.
# Please check /etc/os-release for details about this release.
""",
"/etc/os-release": """
NAME="SLES"
VERSION="12-SP3"
VERSION_ID="12.3"
PRETTY_NAME="SUSE Linux Enterprise Server 12 SP3"
ID="sles"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles_sap:12:sp3"
""",
},
"platform.dist": ['SuSE', '12', 'x86_64'],
"result":{
"distribution": "SLES_SAP",
"distribution_major_version": "12",
"distribution_release": "3",
"os_family": "Suse",
"distribution_version": "12.3",
}
},
{ {
"name": "Debian stretch/sid", "name": "Debian stretch/sid",
"input": { "input": {