14ef6d2b51
- splitting out the susemanager integration plugins into their own subpackages. ATM this only contains the zypp plugin to tell susemanager about manually installed packages. - Unit and integration tests fixes for 2016.3.2 Add: * 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 - Prevent pkg.install failure for expired keys (bsc#996455) Add: * 0017-Check-for-single-quote-before-splitting-on-single-qu.patch - Required D-Bus and generating machine ID where it is missing - Fix sphinx crashes when documentation is being generated Add script for documentation update. Add: * 0016-Improve-Mock-to-be-flexible-and-able-to-mock-methods.patch * update-documentation.sh - Fix pkg.installed refresh repo failure (bsc#993549) Fix salt.states.pkgrepo.management no change failure (bsc#990440) Add: * 0014-Add-ignore_repo_failure-option-to-suppress-zypper-s-.patch * 0015-Remove-zypper-s-raise-exception-if-mod_repo-has-no-a.patch - Deprecate status.uptime one version later Add: OBS-URL: https://build.opensuse.org/request/show/430691 OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=77
83 lines
3.2 KiB
Diff
83 lines
3.2 KiB
Diff
From f860f7ccb3dba6b8f0cef61e2d9658a3116e3c3c Mon Sep 17 00:00:00 2001
|
|
From: Bo Maryniuk <bo@suse.de>
|
|
Date: Mon, 15 Aug 2016 15:03:53 +0200
|
|
Subject: [PATCH 14/15] Add ignore_repo_failure option to suppress zypper's
|
|
exit code 106 on unavailable repos
|
|
|
|
---
|
|
salt/modules/zypper.py | 23 ++++++++++++++++++++---
|
|
1 file changed, 20 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
|
|
index 547d72b..1c60f0f 100644
|
|
--- a/salt/modules/zypper.py
|
|
+++ b/salt/modules/zypper.py
|
|
@@ -100,6 +100,18 @@ class _Zypper(object):
|
|
self.__no_lock = False
|
|
self.__no_raise = False
|
|
self.__refresh = False
|
|
+ self.__ignore_repo_failure = False
|
|
+
|
|
+ def __call__(self, *args, **kwargs):
|
|
+ '''
|
|
+ :param args:
|
|
+ :param kwargs:
|
|
+ :return:
|
|
+ '''
|
|
+ # Ignore exit code for 106 (repo is not available)
|
|
+ if 'no_repo_failure' in kwargs:
|
|
+ self.__ignore_repo_failure = kwargs['no_repo_failure']
|
|
+ return self
|
|
|
|
def __getattr__(self, item):
|
|
'''
|
|
@@ -275,7 +287,7 @@ class _Zypper(object):
|
|
__salt__['event.fire_master']({'success': not len(self.error_msg),
|
|
'info': self.error_msg or 'Zypper has been released'},
|
|
self.TAG_RELEASED)
|
|
- if self.error_msg and not self.__no_raise:
|
|
+ if self.error_msg and not self.__no_raise and not self.__ignore_repo_failure:
|
|
raise CommandExecutionError('Zypper command failure: {0}'.format(self.error_msg))
|
|
|
|
return self._is_xml_mode() and dom.parseString(self.__call_result['stdout']) or self.__call_result['stdout']
|
|
@@ -863,6 +875,7 @@ def install(name=None,
|
|
downloadonly=None,
|
|
skip_verify=False,
|
|
version=None,
|
|
+ ignore_repo_failure=False,
|
|
**kwargs):
|
|
'''
|
|
Install the passed package(s), add refresh=True to force a 'zypper refresh'
|
|
@@ -929,6 +942,10 @@ def install(name=None,
|
|
|
|
salt '*' pkg.install sources='[{"foo": "salt://foo.rpm"},{"bar": "salt://bar.rpm"}]'
|
|
|
|
+ ignore_repo_failure
|
|
+ Zypper returns error code 106 if one of the repositories are not available for various reasons.
|
|
+ In case to set strict check, this parameter needs to be set to True. Default: False.
|
|
+
|
|
|
|
Returns a dict containing the new package names and versions::
|
|
|
|
@@ -1000,7 +1017,7 @@ def install(name=None,
|
|
while targets:
|
|
cmd = cmd_install + targets[:500]
|
|
targets = targets[500:]
|
|
- for line in __zypper__.call(*cmd).splitlines():
|
|
+ for line in __zypper__(no_repo_failure=ignore_repo_failure).call(*cmd).splitlines():
|
|
match = re.match(r"^The selected package '([^']+)'.+has lower version", line)
|
|
if match:
|
|
downgrades.append(match.group(1))
|
|
@@ -1008,7 +1025,7 @@ def install(name=None,
|
|
while downgrades:
|
|
cmd = cmd_install + ['--force'] + downgrades[:500]
|
|
downgrades = downgrades[500:]
|
|
- __zypper__.call(*cmd)
|
|
+ __zypper__(no_repo_failure=ignore_repo_failure).call(*cmd)
|
|
|
|
__context__.pop('pkg.list_pkgs', None)
|
|
new = list_pkgs()
|
|
--
|
|
2.9.3
|
|
|