Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/68247.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Implement SL Micro 6.2 detection to fill the grains with proper values.
12 changes: 12 additions & 0 deletions salt/grains/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2479,6 +2479,18 @@ def _legacy_linux_distribution_data(grains, os_release, lsb_has_error):
grains["oscodename"] = oscodename
if "os" not in grains:
grains["os"] = _derive_os_grain(grains["osfullname"])
if "SUSE_SUPPORT_PRODUCT" in os_release and "SUSE_SUPPORT_PRODUCT_VERSION":
# It's a workaround for very specific case of SL Micro 6.2
# SL Micro 6.2 is different than prevoius ones and identifies itself
# as SLES-16, but transactional. This workaround was made to make the grains
# of SL Micro 6.2 aligned with the previous versions.
grains["oscodename"] = os_release.get(
"SUSE_PRETTY_NAME",
f"{os_release['SUSE_SUPPORT_PRODUCT']} {os_release['SUSE_SUPPORT_PRODUCT_VERSION']}",
)
grains["osrelease"] = os_release["SUSE_SUPPORT_PRODUCT_VERSION"]
if os_release["SUSE_SUPPORT_PRODUCT"] == "SUSE Linux Micro":
grains["osfullname"] = "SL-Micro"
# this assigns family names based on the os name
# family defaults to the os name if not found
grains["os_family"] = _OS_FAMILY_MAP.get(grains["os"], grains["os"])
Expand Down
28 changes: 28 additions & 0 deletions tests/pytests/unit/grains/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,34 @@ def test_suse_os_grains_tumbleweed():
_run_suse_os_grains_tests(_os_release_data, {}, expectation)


@pytest.mark.skip_unless_on_linux
def test_suse_os_grains_slmicro62():
"""
Test if OS grains are parsed correctly in SL Micro 6.2
"""
_os_release_data = {
"NAME": "SLES",
"VERSION": "16.0",
"VERSION_ID": "16.0",
"PRETTY_NAME": "SUSE Linux Enterprise Server 16.0",
"ID": "sles",
"ANSI_COLOR": "0;32",
"CPE_NAME": "cpe:/o:suse:sles:16:16.0",
"SUSE_SUPPORT_PRODUCT": "SUSE Linux Micro",
"SUSE_SUPPORT_PRODUCT_VERSION": "6.2",
"SUSE_PRETTY_NAME": "SUSE Linux Micro 6.2",
}
expectation = {
"oscodename": "SUSE Linux Micro 6.2",
"osfullname": "SL-Micro",
"osrelease": "6.2",
"osrelease_info": (6, 2),
"osmajorrelease": 6,
"osfinger": "SL-Micro-6",
}
_run_suse_os_grains_tests(_os_release_data, {}, expectation)


@pytest.mark.skip_unless_on_linux
def test_debian_9_os_grains():
"""
Expand Down
Loading