2023-01-09 13:52:13 +01:00
|
|
|
From 51bcdcfdec73368d1517150eafda21e4af51dd7a Mon Sep 17 00:00:00 2001
|
2018-09-17 16:18:45 +02:00
|
|
|
From: Jochen Breuer <jbreuer@suse.de>
|
|
|
|
Date: Thu, 6 Sep 2018 17:15:18 +0200
|
|
|
|
Subject: [PATCH] Fix for SUSE Expanded Support detection
|
|
|
|
|
|
|
|
A SUSE ES installation has both, the centos-release and redhat-release
|
|
|
|
file. Since os_data only used the centos-release file to detect a
|
|
|
|
CentOS installation, this lead to SUSE ES being detected as CentOS.
|
|
|
|
|
|
|
|
This change also adds a check for redhat-release and then marks the
|
|
|
|
'lsb_distrib_id' as RedHat.
|
|
|
|
---
|
2019-04-12 11:57:21 +02:00
|
|
|
salt/grains/core.py | 9 +++++++++
|
|
|
|
1 file changed, 9 insertions(+)
|
2018-09-17 16:18:45 +02:00
|
|
|
|
|
|
|
diff --git a/salt/grains/core.py b/salt/grains/core.py
|
2023-01-09 13:52:13 +01:00
|
|
|
index debbeb257d..b55ab4e472 100644
|
2018-09-17 16:18:45 +02:00
|
|
|
--- a/salt/grains/core.py
|
|
|
|
+++ b/salt/grains/core.py
|
2023-01-09 13:52:13 +01:00
|
|
|
@@ -2058,6 +2058,15 @@ def os_data():
|
2021-01-08 13:41:50 +01:00
|
|
|
log.trace("Parsing distrib info from /etc/centos-release")
|
2019-04-12 11:57:21 +02:00
|
|
|
# CentOS Linux
|
2021-01-08 13:41:50 +01:00
|
|
|
grains["lsb_distrib_id"] = "CentOS"
|
2018-09-17 16:18:45 +02:00
|
|
|
+ # Maybe CentOS Linux; could also be SUSE Expanded Support.
|
|
|
|
+ # SUSE ES has both, centos-release and redhat-release.
|
2021-01-08 13:41:50 +01:00
|
|
|
+ if os.path.isfile("/etc/redhat-release"):
|
|
|
|
+ with salt.utils.files.fopen("/etc/redhat-release") as ifile:
|
2018-09-17 16:18:45 +02:00
|
|
|
+ for line in ifile:
|
|
|
|
+ if "red hat enterprise linux server" in line.lower():
|
|
|
|
+ # This is a SUSE Expanded Support Rhel installation
|
2021-01-08 13:41:50 +01:00
|
|
|
+ grains["lsb_distrib_id"] = "RedHat"
|
2018-09-17 16:18:45 +02:00
|
|
|
+ break
|
2021-01-08 13:41:50 +01:00
|
|
|
with salt.utils.files.fopen("/etc/centos-release") as ifile:
|
2018-09-17 16:18:45 +02:00
|
|
|
for line in ifile:
|
|
|
|
# Need to pull out the version and codename
|
|
|
|
--
|
2023-01-09 13:52:13 +01:00
|
|
|
2.37.3
|
2018-09-17 16:18:45 +02:00
|
|
|
|
|
|
|
|