File 0010-add-handling-for-OEM-products.patch of Package salt.3314
From a7a0b80b0ca22a0a898ac4a4f671c08337f8f996 Mon Sep 17 00:00:00 2001
From: Michael Calmer <mc@suse.de>
Date: Tue, 16 Feb 2016 12:56:24 +0100
Subject: [PATCH 10/22] add handling for OEM products
---
salt/modules/zypper.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
index 76170e6..6930f1a 100644
--- a/salt/modules/zypper.py
+++ b/salt/modules/zypper.py
@@ -1205,6 +1205,9 @@ def list_products(all=False):
all
List all products available or only installed. Default is False.
+ Includes handling for OEM products, which read the OEM productline file
+ and overwrite the release value.
+
CLI Examples:
.. code-block:: bash
@@ -1213,6 +1216,7 @@ def list_products(all=False):
salt '*' pkg.list_products all=True
'''
ret = list()
+ OEM_PATH = "/var/lib/suseRegister/OEM"
doc = dom.parseString(__salt__['cmd.run'](("zypper -x products{0}".format(not all and ' -i' or '')),
output_loglevel='trace'))
for prd in doc.getElementsByTagName('product-list')[0].getElementsByTagName('product'):
@@ -1226,7 +1230,13 @@ def list_products(all=False):
prd.getElementsByTagName('description')
).split(os.linesep)]
)
-
+ if 'productline' in p_nfo and p_nfo['productline']:
+ oem_file = os.path.join(OEM_PATH, p_nfo['productline'])
+ if os.path.isfile(oem_file):
+ with salt.utils.fopen(oem_file, 'r') as rfile:
+ oem_release = rfile.readline().strip()
+ if oem_release:
+ p_nfo['release'] = oem_release
ret.append(p_nfo)
return ret
--
2.1.4