SHA256
1
0
forked from pool/salt
salt/0011-Check-if-EOL-is-available-in-a-particular-product-bs.patch
Klaus Kämpf 56c946e70f Accepting request 391560 from systemsmanagement:saltstack:testing
- Prevent crash if pygit2 package requests recompilation.
  Add:
  * 0013-Prevent-crash-if-pygit2-package-is-requesting-re-com.patch
- Align OS grains from older SLES with the current one (bsc#975757)
  Add:
  * 0014-align-OS-grains-from-older-SLES-with-current-one-326.patch

- remove patches which produce duplicate functions:
  Remove:
  * 0004-implement-version_cmp-for-zypper.patch
  * 0005-pylint-changes.patch
  * 0006-Check-if-rpm-python-can-be-imported.patch
- remove patches which add and revert the same file
  Remove:
  * 0007-Initial-Zypper-Unit-Tests-and-bugfixes.patch
  * 0009-Bugfix-on-SLE11-series-base-product-reported-as-addi.patch
- rename patches:
  0008-do-not-generate-a-date-in-a-comment-to-prevent-rebui.patch to
     0004-do-not-generate-a-date-in-a-comment-to-prevent-rebui.patch
  0010-Use-SHA256-hash-type-by-default.patch to
     0005-Use-SHA256-hash-type-by-default.patch
  0011-Update-to-2015.8.8.2.patch to
     0006-Update-to-2015.8.8.2.patch
  0012-Force-sort-the-RPM-output-to-ensure-latest-version-o.patch to
     0007-Force-sort-the-RPM-output-to-ensure-latest-version-o.patch
  0013-Cleaner-deprecation-process-with-decorators.patch  to
     0008-Cleaner-deprecation-process-with-decorators.patch
- fix sorting by latest package
  Add:
  * 0009-fix-sorting-by-latest-version-when-called-with-an-at.patch
- Prevent metadata download when getting installed products
  Add:
  * 0010-Prevent-metadata-download-when-getting-installed-pro.patch
- Check if EOL is available in a particular product (bsc#975093)
  Add:
  * 0011-Check-if-EOL-is-available-in-a-particular-product-bs.patch
- Bugfix: salt-key crashes if tries to generate keys 
  to the directory w/o write access (bsc#969320)
  Add:
  * 0012-Bugfix-salt-key-crashes-if-tries-to-generate-keys-to.patch

- Deprecation process using decorators and re-implementation
  of status.update function.
  Add:
  * 0013-Cleaner-deprecation-process-with-decorators.patch

- Reverted the fake 2015.8.8.2 patch, with the right one,
- this patch only contains:
  - https://github.com/saltstack/salt/pull/32135 
  - https://github.com/saltstack/salt/pull/32023 
  - https://github.com/saltstack/salt/pull/32117

- Ensure that in case of multi-packages installed on the system,
  the latest is reported by pkg.info_installed (bsc#972490)
  Add:
  * 0012-Force-sort-the-RPM-output-to-ensure-latest-version-o.patch

- Update to the fake 2015.8.8.2 release
  upstream released a bunch of fixes on top of 2015.8.8, without creating a new
  tag and proper release. This commit includes all the changes between tag
  v2015.8.8 and commit ID 596444e2b447b7378dbcdfeb9fc9610b90057745 which
  introduces the fake 2015.8.8.2 release.
  see https://docs.saltstack.com/en/latest/topics/releases/2015.8.8.html#salt-2015-8-8-2

- Update to 2015.8.8
  see https://docs.saltstack.com/en/latest/topics/releases/2015.8.8.html
  Patches renamed:
  * 0004-implement-version_cmp-for-zypper.patch
  * 0005-pylint-changes.patch
  * 0006-Check-if-rpm-python-can-be-imported.patch
  * 0007-Initial-Zypper-Unit-Tests-and-bugfixes.patch
  * 0008-do-not-generate-a-date-in-a-comment-to-prevent-rebui.patch
  * 0009-Bugfix-on-SLE11-series-base-product-reported-as-addi.patch
  * 0010-Use-SHA256-hash-type-by-default.patch
  Patches removed:
  * 0004-Fix-pkg.latest-prevent-crash-on-multiple-package-ins.patch
  * 0005-Fix-package-status-filtering-on-latest-version-and-i.patch
  * 0006-add_key-reject_key-do-not-crash-w-Permission-denied-.patch
  * 0007-Force-kill-websocket-s-child-processes-faster-than-d.patch
  * 0008-Fix-types-in-the-output-data-and-return-just-a-list-.patch
  * 0009-The-functions-in-the-state-module-that-return-a-retc.patch
  * 0010-add-handling-for-OEM-products.patch
  * 0011-improve-doc-for-list_pkgs.patch
  * 0012-implement-version_cmp-for-zypper.patch
  * 0013-pylint-changes.patch
  * 0014-Check-if-rpm-python-can-be-imported.patch
  * 0015-call-zypper-with-option-non-interactive-everywhere.patch
  * 0016-write-a-zypper-command-builder-function.patch
  * 0017-Fix-crash-with-scheduler-and-runners-31106.patch
  * 0018-unify-behavior-of-refresh.patch
  * 0019-add-refresh-option-to-more-functions.patch
  * 0020-simplify-checking-the-refresh-paramater.patch
  * 0021-do-not-change-kwargs-in-refresh-while-checking-a-val.patch
  * 0022-fix-argument-handling-for-pkg.download.patch
  * 0023-Initial-Zypper-Unit-Tests-and-bugfixes.patch
  * 0024-proper-checking-if-zypper-exit-codes-and-handling-of.patch
  * 0025-adapt-tests-to-new-zypper_check_result-output.patch
  * 0026-do-not-generate-a-date-in-a-comment-to-prevent-rebui.patch
  * 0027-make-suse-check-consistent-with-rh_service.patch
  * 0028-fix-numerical-check-of-osrelease.patch
  * 0029-Make-use-of-checksum-configurable-defaults-to-MD5-SH.patch
  * 0030-Bugfix-on-SLE11-series-base-product-reported-as-addi.patch
  * 0031-Only-use-LONGSIZE-in-rpm.info-if-available.-Otherwis.patch
  * 0032-Add-error-check-when-retcode-is-0-but-stderr-is-pres.patch
  * 0033-fixing-init-system-dectection-on-sles-11-refs-31617.patch
  * 0034-Fix-git_pillar-race-condition.patch
  * 0035-Fix-the-always-false-behavior-on-checking-state.patch
  * 0036-Use-SHA256-hash-type-by-default.patch

OBS-URL: https://build.opensuse.org/request/show/391560
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=66
2016-04-28 07:26:14 +00:00

147 lines
9.9 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From aae1c09957eab3c89a6c8f78a579cdf9dcfbe188 Mon Sep 17 00:00:00 2001
From: Bo Maryniuk <bo@suse.de>
Date: Tue, 12 Apr 2016 13:52:35 +0200
Subject: [PATCH 11/12] Check if EOL is available in a particular product
(bsc#975093)
Update SLE11 SP3 data
Update SLE12 SP1 data
Adjust test values according to the testing data
---
salt/modules/zypper.py | 13 +++++++--
.../unit/modules/zypp/zypper-products-sle11sp3.xml | 10 +++++++
.../unit/modules/zypp/zypper-products-sle12sp1.xml | 8 ++++++
tests/unit/modules/zypper_test.py | 32 ++++++++++++----------
4 files changed, 45 insertions(+), 18 deletions(-)
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
index 9702f42..4ce5853 100644
--- a/salt/modules/zypper.py
+++ b/salt/modules/zypper.py
@@ -1318,12 +1318,19 @@ def list_products(all=False, refresh=False):
call = __salt__['cmd.run_all'](cmd, output_loglevel='trace')
doc = dom.parseString(_zypper_check_result(call, xml=True))
- for prd in doc.getElementsByTagName('product-list')[0].getElementsByTagName('product'):
+ product_list = doc.getElementsByTagName('product-list')
+ if not product_list:
+ return ret # No products found
+
+ for prd in product_list[0].getElementsByTagName('product'):
p_nfo = dict()
for k_p_nfo, v_p_nfo in prd.attributes.items():
p_nfo[k_p_nfo] = k_p_nfo not in ['isbase', 'installed'] and v_p_nfo or v_p_nfo in ['true', '1']
- p_nfo['eol'] = prd.getElementsByTagName('endoflife')[0].getAttribute('text')
- p_nfo['eol_t'] = int(prd.getElementsByTagName('endoflife')[0].getAttribute('time_t'))
+
+ eol = prd.getElementsByTagName('endoflife')
+ if eol:
+ p_nfo['eol'] = eol[0].getAttribute('text')
+ p_nfo['eol_t'] = int(eol[0].getAttribute('time_t') or 0)
p_nfo['description'] = " ".join(
[line.strip() for line in _get_first_aggregate_text(
prd.getElementsByTagName('description')
diff --git a/tests/unit/modules/zypp/zypper-products-sle11sp3.xml b/tests/unit/modules/zypp/zypper-products-sle11sp3.xml
index 89a85e3..99444fe 100644
--- a/tests/unit/modules/zypp/zypper-products-sle11sp3.xml
+++ b/tests/unit/modules/zypp/zypper-products-sle11sp3.xml
@@ -31,7 +31,17 @@
offers common management tools and technology
certifications across the platform, and
each product is enterprise-class.</description></product>
+<product name="SUSE_SLES" version="11.3" release="1.201" epoch="0" arch="x86_64" productline="" registerrelease="" vendor="SUSE LINUX Products GmbH, Nuernberg, Germany" summary="SUSE Linux Enterprise Server 11 SP3 No EOL" shortname="" flavor="" isbase="0" repo="nu_novell_com:SLES11-SP3-Updates" installed="0">0x7ffdb538e948<description>SUSE Linux Enterprise offers a comprehensive
+ suite of products built on a single code base.
+ The platform addresses business needs from
+ the smallest thin-client devices to the worlds
+ most powerful high-performance computing
+ and mainframe servers. SUSE Linux Enterprise
+ offers common management tools and technology
+ certifications across the platform, and
+ each product is enterprise-class.</description></product>
<product name="SUSE-Manager-Server" version="2.1" release="1.2" epoch="0" arch="x86_64" productline="" registerrelease="" vendor="SUSE LINUX Products GmbH, Nuernberg, Germany" summary="SUSE Manager Server" shortname="" flavor="cd" isbase="0" repo="nu_novell_com:SUSE-Manager-Server-2.1-Pool" installed="0"><endoflife time_t="0" text="1970-01-01T01:00:00+0100"/>0x7ffdb538e948<description>SUSE Manager Server appliance</description></product>
<product name="SUSE-Manager-Server" version="2.1" release="1.2" epoch="0" arch="x86_64" productline="manager" registerrelease="" vendor="SUSE LINUX Products GmbH, Nuernberg, Germany" summary="SUSE Manager Server" shortname="" flavor="cd" isbase="1" repo="@System" installed="1"><endoflife time_t="0" text="1970-01-01T01:00:00+0100"/>0x7ffdb538e948<description>SUSE Manager Server appliance</description></product>
+<product name="SUSE-Manager-Server-Broken-EOL" version="2.1" release="1.2" epoch="0" arch="x86_64" productline="manager" registerrelease="" vendor="SUSE LINUX Products GmbH, Nuernberg, Germany" summary="SUSE Manager Server" shortname="" flavor="cd" isbase="1" repo="@System" installed="1"><endoflife wrong="attribute"/>0x7ffdb538e948<description>SUSE Manager Server appliance</description></product>
</product-list>
</stream>
diff --git a/tests/unit/modules/zypp/zypper-products-sle12sp1.xml b/tests/unit/modules/zypp/zypper-products-sle12sp1.xml
index 1a50363..a086058 100644
--- a/tests/unit/modules/zypp/zypper-products-sle12sp1.xml
+++ b/tests/unit/modules/zypp/zypper-products-sle12sp1.xml
@@ -24,6 +24,14 @@ provisioning.</description></product>
SUSE Manager Tools provide packages required to connect to a
SUSE Manager Server.
&lt;p&gt;</description></product>
+<product name="sle-manager-tools-beta-no-eol" version="12" release="0" epoch="0" arch="x86_64" vendor="obs://build.suse.de/Devel:Galaxy:Manager:Head" summary="SUSE Manager Tools" repo="SUSE-Manager-Head" productline="" registerrelease="" shortname="Manager-Tools" flavor="POOL" isbase="false" installed="false"><registerflavor>extension</registerflavor><description>&lt;p&gt;
+ SUSE Manager Tools provide packages required to connect to a
+ SUSE Manager Server.
+ &lt;p&gt;</description></product>
+<product name="sle-manager-tools-beta-broken-eol" version="12" release="0" epoch="0" arch="x86_64" vendor="obs://build.suse.de/Devel:Galaxy:Manager:Head" summary="SUSE Manager Tools" repo="SUSE-Manager-Head" productline="" registerrelease="" shortname="Manager-Tools" flavor="POOL" isbase="false" installed="false"><endoflife wrong="attribute"/><registerflavor>extension</registerflavor><description>&lt;p&gt;
+ SUSE Manager Tools provide packages required to connect to a
+ SUSE Manager Server.
+ &lt;p&gt;</description></product>
<product name="SLES" version="12.1" release="0" epoch="0" arch="x86_64" vendor="SUSE" summary="SUSE Linux Enterprise Server 12 SP1" repo="@System" productline="sles" registerrelease="" shortname="SLES12-SP1" flavor="DVD" isbase="true" installed="true"><endoflife time_t="1730332800" text="2024-10-31T01:00:00+01"/><registerflavor/><description>SUSE Linux Enterprise offers a comprehensive
suite of products built on a single code base.
The platform addresses business needs from
diff --git a/tests/unit/modules/zypper_test.py b/tests/unit/modules/zypper_test.py
index 67cf52a..97e42ef 100644
--- a/tests/unit/modules/zypper_test.py
+++ b/tests/unit/modules/zypper_test.py
@@ -153,24 +153,26 @@ class ZypperTestCase(TestCase):
for filename, test_data in {
'zypper-products-sle12sp1.xml': {
'name': ['SLES', 'SLES', 'SUSE-Manager-Proxy',
- 'SUSE-Manager-Server', 'sle-manager-tools-beta'],
+ 'SUSE-Manager-Server', 'sle-manager-tools-beta',
+ 'sle-manager-tools-beta-broken-eol', 'sle-manager-tools-beta-no-eol'],
'vendor': 'SUSE LLC <https://www.suse.com/>',
- 'release': ['0', '0', '0', '0', '0'],
- 'productline': [False, False, False, False, 'sles'],
- 'eol_t': [1509408000, 1522454400, 1522454400, 1730332800, 1730332800],
- 'isbase': [False, False, False, False, True],
- 'installed': [False, False, False, False, True],
+ 'release': ['0', '0', '0', '0', '0', '0', '0'],
+ 'productline': [False, False, False, False, False, False, 'sles'],
+ 'eol_t': [None, 0, 1509408000, 1522454400, 1522454400, 1730332800, 1730332800],
+ 'isbase': [False, False, False, False, False, False, True],
+ 'installed': [False, False, False, False, False, False, True],
},
'zypper-products-sle11sp3.xml': {
- 'name': ['SUSE-Manager-Server', 'SUSE-Manager-Server',
- 'SUSE_SLES', 'SUSE_SLES', 'SUSE_SLES-SP4-migration'],
+ 'name': ['SUSE-Manager-Server', 'SUSE-Manager-Server', 'SUSE-Manager-Server-Broken-EOL',
+ 'SUSE_SLES', 'SUSE_SLES', 'SUSE_SLES', 'SUSE_SLES-SP4-migration'],
'vendor': 'SUSE LINUX Products GmbH, Nuernberg, Germany',
- 'release': ['1.138', '1.2', '1.2', '1.201', '1.4'],
- 'productline': [False, False, False, False, 'manager'],
- 'eol_t': [0, 0, 0, 0, 0],
- 'isbase': [False, False, False, False, True],
- 'installed': [False, False, False, False, True],
+ 'release': ['1.138', '1.2', '1.2', '1.2', '1.201', '1.201', '1.4'],
+ 'productline': [False, False, False, False, False, 'manager', 'manager'],
+ 'eol_t': [None, 0, 0, 0, 0, 0, 0],
+ 'isbase': [False, False, False, False, False, True, True],
+ 'installed': [False, False, False, False, False, True, True],
}}.items():
+
ref_out = {
'retcode': 0,
'stdout': get_test_data(filename)
@@ -178,10 +180,10 @@ class ZypperTestCase(TestCase):
with patch.dict(zypper.__salt__, {'cmd.run_all': MagicMock(return_value=ref_out)}):
products = zypper.list_products()
- self.assertEqual(len(products), 5)
+ self.assertEqual(len(products), 7)
self.assertIn(test_data['vendor'], [product['vendor'] for product in products])
for kwd in ['name', 'isbase', 'installed', 'release', 'productline', 'eol_t']:
- self.assertEqual(test_data[kwd], sorted([prod[kwd] for prod in products]))
+ self.assertEqual(test_data[kwd], sorted([prod.get(kwd) for prod in products]))
def test_refresh_db(self):
'''
--
2.1.4