From 3ff426ca5f91a525f3d7894c53e1980f5150757a Mon Sep 17 00:00:00 2001 From: Jochen Breuer Date: Fri, 8 May 2020 22:20:48 +0300 Subject: [PATCH] Port #49538 to master --- salt/grains/core.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/salt/grains/core.py b/salt/grains/core.py index 43a978bb414b..c02e4532d347 100644 --- a/salt/grains/core.py +++ b/salt/grains/core.py @@ -2023,8 +2023,16 @@ def os_data(): ) elif os.path.isfile("/etc/centos-release"): log.trace("Parsing distrib info from /etc/centos-release") - # CentOS Linux - grains["lsb_distrib_id"] = "CentOS" + # Maybe CentOS Linux; could also be SUSE Expanded Support. + # SUSE ES has both, centos-release and redhat-release. + if os.path.isfile("/etc/redhat-release"): + with salt.utils.files.fopen("/etc/redhat-release") as ifile: + for line in ifile: + if "red hat enterprise linux server" in line.lower(): + # This is a SUSE Expanded Support Rhel installation + grains["lsb_distrib_id"] = "RedHat" + break + grains.setdefault("lsb_distrib_id", "CentOS") with salt.utils.files.fopen("/etc/centos-release") as ifile: for line in ifile: # Need to pull out the version and codename