Klaus Kämpf 2016-11-06 15:19:46 +00:00 committed by Git OBS Bridge
parent 44f6a131de
commit c107c48fcc

View File

@ -1,99 +0,0 @@
From db37086d3322aeba397ed7f66925b51fc61f4fca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
<psuarezhernandez@suse.com>
Date: Tue, 18 Oct 2016 14:14:42 +0100
Subject: [PATCH 16/18] Adding 'dist-upgrade' support to zypper module
* Unit tests for zypper upgrade and dist-upgrade
* Refactor: Cleanup and pylint fixes
* Fix in log message
* Adds multiple repositories support to 'fromrepo' parameter
* Improves 'dryrun' outputting. Setting 'novendorchange' as not supported for SLE11
* Unit tests fixes
* Minor pylint fixes
* Disables 'novendorchange' for old SLEs versions
---
salt/modules/zypper.py | 45 ++++++++++++++++++++++++++++-----------------
1 file changed, 28 insertions(+), 17 deletions(-)
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
index 49ce5ecc5409..d1febee73597 100644
--- a/salt/modules/zypper.py
+++ b/salt/modules/zypper.py
@@ -1072,34 +1072,25 @@ def install(name=None,
def upgrade(refresh=True,
+ skip_verify=False,
dryrun=False,
dist_upgrade=False,
fromrepo=None,
novendorchange=False,
- skip_verify=False,
**kwargs): # pylint: disable=unused-argument
'''
- .. versionchanged:: 2015.8.12,2016.3.3,Carbon
- On minions running systemd>=205, `systemd-run(1)`_ is now used to
- isolate commands which modify installed packages from the
- ``salt-minion`` daemon's control group. This is done to keep systemd
- from killing any zypper commands spawned by Salt when the
- ``salt-minion`` service is restarted. (see ``KillMode`` in the
- `systemd.kill(5)`_ manpage for more information). If desired, usage of
- `systemd-run(1)`_ can be suppressed by setting a :mod:`config option
- <salt.modules.config.get>` called ``systemd.scope``, with a value of
- ``False`` (no quotes).
-
- .. _`systemd-run(1)`: https://www.freedesktop.org/software/systemd/man/systemd-run.html
- .. _`systemd.kill(5)`: https://www.freedesktop.org/software/systemd/man/systemd.kill.html
-
Run a full system upgrade, a zypper upgrade
+ Options:
+
refresh
force a refresh if set to True (default).
If set to False it depends on zypper if a refresh is
executed.
+ skip_verify
+ Skip the GPG verification check (e.g., ``--no-gpg-checks``)
+
dryrun
If set to True, it creates a debug solver log file and then perform
a dry-run upgrade (no changes are made). Default: False
@@ -1164,10 +1155,30 @@ def upgrade(refresh=True,
if skip_verify:
cmd_update.append('--no-gpg-checks')
- old = list_pkgs()
+ if dryrun:
+ cmd_update.append('--dry-run')
- __zypper__(systemd_scope=_systemd_scope()).noraise.call(*cmd_update)
+ if dist_upgrade:
+ if dryrun:
+ # Creates a solver test case for debugging.
+ log.info('Executing debugsolver and performing a dry-run dist-upgrade')
+ __zypper__.noraise.call(*cmd_update + ['--debug-solver'])
+
+ if fromrepo:
+ for repo in fromrepo:
+ cmd_update.extend(['--from', repo])
+ log.info('Targeting repos: {0!r}'.format(fromrepo))
+ if novendorchange:
+ # TODO: Grains validation should be moved to Zypper class
+ if __grains__['osrelease_info'][0] > 11:
+ cmd_update.append('--no-allow-vendor-change')
+ log.info('Disabling vendor changes')
+ else:
+ log.warn('Disabling vendor changes is not supported on this Zypper version')
+
+ old = list_pkgs()
+ __zypper__(systemd_scope=_systemd_scope()).noraise.call(*cmd_update)
if __zypper__.exit_code not in __zypper__.SUCCESS_EXIT_CODES:
ret['result'] = False
else:
--
2.10.1