Compare commits

3 Commits
1.1 ... main

3 changed files with 64 additions and 0 deletions

View File

@@ -1,3 +1,22 @@
-------------------------------------------------------------------
Mon May 26 12:43:54 UTC 2025 - Harshvardhan Sharma <harshvardhan.sharma@suse.com>
- Extend suse-distribution-fix.patch:
* Also detect VARIANT_ID='sles-sap' as SLES_SAP
-------------------------------------------------------------------
Tue May 20 10:18:01 UTC 2025 - Harshvardhan Sharma <harshvardhan.sharma@suse.com>
- Add missing dependency on python311-rpm required by package_facts
(#1243193)
-------------------------------------------------------------------
Tue Apr 22 13:59:15 UTC 2025 - Harshvardhan Sharma <harshvardhan.sharma@suse.com>
- Add patch suse-distribution-fix.patch to fix distribution.py
to identify the correct distribution for server-sap and micro
(#PED-12643)
-------------------------------------------------------------------
Fri Mar 7 08:09:45 UTC 2025 - Harshvardhan Sharma <harshvardhan.sharma@suse.com>

View File

@@ -56,6 +56,8 @@ Patch1: https://github.com/ansible/ansible/commit/771f7ad29ca4d259761eaa
# Upstream commit: d500354798beb9bf8341eb8e84e1e2046bbfd21b
# Reference: https://github.com/ansible/ansible/commit/d500354798beb9bf8341eb8e84e1e2046bbfd21b
Patch2: unarchive-test-fix.patch
# Patch to fix distribution.py to identify the correct distribution for server-sap and micro
Patch3: suse-distribution-fix.patch
BuildArch: noarch
# cannot be installed with ansible < 3 or ansible-base
@@ -97,6 +99,7 @@ Requires: %{ansible_python}-Jinja2 >= 3.0.0
Requires: %{ansible_python}-PyYAML >= 5.1
Requires: %{ansible_python}-cryptography
Requires: %{ansible_python}-packaging
Requires: %{ansible_python}-rpm
Requires: (%{ansible_python}-resolvelib >= 0.5.3 with %{ansible_python}-resolvelib < 2.0.0)
# ansible-documentation is a separate package since 2.15.3

View File

@@ -0,0 +1,42 @@
From bffda9eb661a8560bb9ac9e240ec70a2552aa2a8 Mon Sep 17 00:00:00 2001
From: HVSharma12 <harshvardhan.sharma@suse.com>
Date: Mon, 26 May 2025 18:08:53 +0530
Subject: [PATCH] Adjust distribution detection logic for SUSE
---
.../module_utils/facts/system/distribution.py | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/lib/ansible/module_utils/facts/system/distribution.py b/lib/ansible/module_utils/facts/system/distribution.py
index 7554ef1ae3..5ec94c92d1 100644
--- a/lib/ansible/module_utils/facts/system/distribution.py
+++ b/lib/ansible/module_utils/facts/system/distribution.py
@@ -311,9 +311,22 @@ class DistributionFiles:
suse_facts['distribution_release'] = release.group(1)
suse_facts['distribution_version'] = collected_facts['distribution_version'] + '.' + release.group(1)
- # See https://www.suse.com/support/kb/doc/?id=000019341 for SLES for SAP
- if os.path.islink('/etc/products.d/baseproduct') and os.path.realpath('/etc/products.d/baseproduct').endswith('SLES_SAP.prod'):
- suse_facts['distribution'] = 'SLES_SAP'
+ # Check VARIANT_ID first for SLES4SAP or SL-Micro
+ variant_id_match = re.search(r'^VARIANT_ID="?([^"\n]*)"?', data, re.MULTILINE)
+ if variant_id_match:
+ variant_id = variant_id_match.group(1)
+ if variant_id in ('server-sap', 'sles-sap'):
+ suse_facts['distribution'] = 'SLES_SAP'
+ elif variant_id == 'transactional':
+ suse_facts['distribution'] = 'SL-Micro'
+ else:
+ # Fallback for older SLES 15 using baseproduct symlink
+ if os.path.islink('/etc/products.d/baseproduct'):
+ resolved = os.path.realpath('/etc/products.d/baseproduct')
+ if resolved.endswith('SLES_SAP.prod'):
+ suse_facts['distribution'] = 'SLES_SAP'
+ elif resolved.endswith('SL-Micro.prod'):
+ suse_facts['distribution'] = 'SL-Micro'
return True, suse_facts
--
2.49.0