mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
add handling for OEM products
This commit is contained in:
parent
415654ee9e
commit
d773b7317b
1 changed files with 11 additions and 1 deletions
|
@ -1204,6 +1204,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
|
||||
|
@ -1212,6 +1215,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'):
|
||||
|
@ -1225,7 +1229,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
|
||||
|
|
Loading…
Add table
Reference in a new issue