diff --git a/salt/grains/core.py b/salt/grains/core.py index 710c57f28f..124d7c25cd 100644 --- a/salt/grains/core.py +++ b/salt/grains/core.py @@ -1764,6 +1764,7 @@ def _derive_os_grain(osfullname, os_id=None): # post-_OS_NAME_MAP. If your system is having trouble with detection, please # make sure that the 'os' grain is capitalized and working correctly first. _OS_FAMILY_MAP = { + "ALT": "RedHat", "Ubuntu": "Debian", "Fedora": "RedHat", "Chapeau": "RedHat", @@ -2218,6 +2219,8 @@ def _legacy_linux_distribution_data(grains, os_release, lsb_has_error): cpe = _parse_cpe_name(os_release["CPE_NAME"]) if not cpe: log.error("Broken CPE_NAME format in /etc/os-release!") + elif cpe.get('vendor', '').lower() == 'alt': + grains['os'] = 'ALT' elif cpe.get("vendor", "").lower() in ["suse", "opensuse"]: grains["os"] = "SUSE" # openSUSE `osfullname` grain normalization @@ -2352,6 +2355,8 @@ 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 grains["lsb_distrib_id"] != grains["os"]: + grains["os"] = grains["lsb_distrib_id"] # 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"])