SHA256
1
0
forked from pool/salt
salt/0017-Including-resolver-params-for-Zypper-debug-solver.patch
Klaus Kämpf 44f6a131de Accepting request 438684 from systemsmanagement:saltstack:testing
- Update to 2016.3.4
  see https://docs.saltstack.com/en/latest/topics/releases/2016.3.4.html
- Removed Patches, applied upstream
  * 0008-checksum-validation-when-zypper-pkg.download.patch
  * 0009-unit-tests-for-rpm.checksum-and-zypper.download.patch
  * 0010-snapper-execution-module.patch
  * 0011-fix-salt-summary-to-count-not-responding-minions-cor.patch
  * 0012-Run-salt-api-as-user-salt-bsc-990029.patch
  * 0013-Deprecate-status.uptime-one-version-later.patch
  * 0014-Add-ignore_repo_failure-option-to-suppress-zypper-s-.patch
  * 0015-Remove-zypper-s-raise-exception-if-mod_repo-has-no-a.patch
  * 0016-Improve-Mock-to-be-flexible-and-able-to-mock-methods.patch
  * 0017-Check-for-single-quote-before-splitting-on-single-qu.patch
  * 0018-Unit-tests-fixes-for-2016.3.2.patch
  * 0019-Fix-snapper_test-for-python26.patch
  * 0020-Integration-tests-fixes-for-2016.3.2.patch
  * 0021-Fix-pkg.upgrade-for-zypper.patch
  * 0022-Setting-up-OS-grains-for-SLES-Expanded-Support-SUSE-.patch
  * 0023-acl.delfacl-fix-position-of-X-option-to-setfacl.patch
  * 0024-Change-travis-configuration-file-to-use-salt-toaster.patch
  * 0025-Adding-dist-upgrade-support-to-zypper-module.patch
  * 0026-Fix-pkg.latest_version-when-latest-already-installed.patch
  * 0027-Including-resolver-params-for-Zypper-debug-solver.patch
- Added patches
  * 0008-snapper-execution-module.patch
  * 0009-fix-salt-summary-to-count-not-responding-minions-cor.patch
  * 0010-Run-salt-api-as-user-salt-bsc-990029.patch
  * 0011-Fix-snapper_test-for-python26.patch
  * 0012-Fix-pkg.upgrade-for-zypper.patch
  * 0013-Setting-up-OS-grains-for-SLES-Expanded-Support-SUSE-.patch

OBS-URL: https://build.opensuse.org/request/show/438684
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=81
2016-11-06 11:48:16 +00:00

75 lines
3.5 KiB
Diff

From e572a2774e186681820c6e9fc6df65516eba2abf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
<psuarezhernandez@suse.com>
Date: Mon, 31 Oct 2016 16:15:36 +0000
Subject: [PATCH 17/17] Including resolver params for Zypper debug-solver
Now '--no-allow-vendor-change' and '--from' parameters are included
into the zypper --debug-solver call before performing a dry-run dist-upgrade.
---
salt/modules/zypper.py | 15 ++++++++-------
tests/unit/modules/zypper_test.py | 7 +++++++
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
index 49ce5ec..98451bf 100644
--- a/salt/modules/zypper.py
+++ b/salt/modules/zypper.py
@@ -1136,6 +1136,10 @@ def upgrade(refresh=True,
cmd_update = (['dist-upgrade'] if dist_upgrade else ['update']) + ['--auto-agree-with-licenses']
+ if skip_verify:
+ # The '--no-gpg-checks' needs to be placed before the Zypper command.
+ cmd_update.insert(0, '--no-gpg-checks')
+
if refresh:
refresh_db()
@@ -1143,11 +1147,6 @@ def upgrade(refresh=True,
cmd_update.append('--dry-run')
if dist_upgrade:
- if dryrun:
- # Creates a solver test case for debugging.
- log.info('Executing debugsolver and performing a dry-run dist-upgrade')
- __zypper__(systemd_scope=_systemd_scope()).noraise.call(*cmd_update + ['--debug-solver'])
-
if fromrepo:
for repo in fromrepo:
cmd_update.extend(['--from', repo])
@@ -1161,8 +1160,10 @@ def upgrade(refresh=True,
else:
log.warn('Disabling vendor changes is not supported on this Zypper version')
- if skip_verify:
- cmd_update.append('--no-gpg-checks')
+ if dryrun:
+ # Creates a solver test case for debugging.
+ log.info('Executing debugsolver and performing a dry-run dist-upgrade')
+ __zypper__(systemd_scope=_systemd_scope()).noraise.call(*cmd_update + ['--debug-solver'])
old = list_pkgs()
diff --git a/tests/unit/modules/zypper_test.py b/tests/unit/modules/zypper_test.py
index fe170b4..56f68b6 100644
--- a/tests/unit/modules/zypper_test.py
+++ b/tests/unit/modules/zypper_test.py
@@ -359,6 +359,13 @@ class ZypperTestCase(TestCase):
zypper_mock.assert_any_call('dist-upgrade', '--auto-agree-with-licenses', '--dry-run')
zypper_mock.assert_any_call('dist-upgrade', '--auto-agree-with-licenses', '--dry-run', '--debug-solver')
+ with patch('salt.modules.zypper.list_pkgs', MagicMock(side_effect=[{"vim": "1.1"}, {"vim": "1.1"}])):
+ ret = zypper.upgrade(dist_upgrade=True, dryrun=True, fromrepo=["Dummy", "Dummy2"], novendorchange=True)
+ self.assertTrue(ret['result'])
+ self.assertDictEqual(ret['changes'], {})
+ zypper_mock.assert_any_call('dist-upgrade', '--auto-agree-with-licenses', '--dry-run', '--from', "Dummy", '--from', 'Dummy2', '--no-allow-vendor-change')
+ zypper_mock.assert_any_call('dist-upgrade', '--auto-agree-with-licenses', '--dry-run', '--from', "Dummy", '--from', 'Dummy2', '--no-allow-vendor-change', '--debug-solver')
+
with patch('salt.modules.zypper.list_pkgs', MagicMock(side_effect=[{"vim": "1.1"}, {"vim": "1.2"}])):
ret = zypper.upgrade(dist_upgrade=True, fromrepo=["Dummy", "Dummy2"], novendorchange=True)
self.assertTrue(ret['result'])
--
2.10.1