40 lines
1.8 KiB
Diff
40 lines
1.8 KiB
Diff
|
From 0961f5bd3e3b7aa3ebd75fe064044d078df62724 Mon Sep 17 00:00:00 2001
|
||
|
From: Michael Calmer <mc@suse.de>
|
||
|
Date: Mon, 18 Apr 2016 16:31:58 +0200
|
||
|
Subject: [PATCH 14/14] align OS grains from older SLES with current one
|
||
|
(#32649)
|
||
|
|
||
|
---
|
||
|
salt/grains/core.py | 9 +++++++--
|
||
|
1 file changed, 7 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/salt/grains/core.py b/salt/grains/core.py
|
||
|
index eb62b97..d5dbef8 100644
|
||
|
--- a/salt/grains/core.py
|
||
|
+++ b/salt/grains/core.py
|
||
|
@@ -1184,14 +1184,19 @@ def os_data():
|
||
|
for line in fhr:
|
||
|
if 'enterprise' in line.lower():
|
||
|
grains['lsb_distrib_id'] = 'SLES'
|
||
|
+ grains['lsb_distrib_codename'] = re.sub(r'\(.+\)', '', line).strip()
|
||
|
elif 'version' in line.lower():
|
||
|
version = re.sub(r'[^0-9]', '', line)
|
||
|
elif 'patchlevel' in line.lower():
|
||
|
patch = re.sub(r'[^0-9]', '', line)
|
||
|
grains['lsb_distrib_release'] = version
|
||
|
if patch:
|
||
|
- grains['lsb_distrib_release'] += ' SP' + patch
|
||
|
- grains['lsb_distrib_codename'] = 'n.a'
|
||
|
+ grains['lsb_distrib_release'] += '.' + patch
|
||
|
+ patchstr = 'SP' + patch
|
||
|
+ if grains['lsb_distrib_codename'] and patchstr not in grains['lsb_distrib_codename']:
|
||
|
+ grains['lsb_distrib_codename'] += ' ' + patchstr
|
||
|
+ if not grains['lsb_distrib_codename']:
|
||
|
+ grains['lsb_distrib_codename'] = 'n.a'
|
||
|
elif os.path.isfile('/etc/altlinux-release'):
|
||
|
# ALT Linux
|
||
|
grains['lsb_distrib_id'] = 'altlinux'
|
||
|
--
|
||
|
2.8.1
|
||
|
|