75 lines
3.5 KiB
Diff
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
|
||
|
|