OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=131
63 lines
2.4 KiB
Diff
63 lines
2.4 KiB
Diff
From 71e7ecfbb07cf14680a2a39de48a6e60cd20cb07 Mon Sep 17 00:00:00 2001
|
|
From: Bo Maryniuk <bo@suse.de>
|
|
Date: Wed, 26 Sep 2018 17:54:53 +0200
|
|
Subject: [PATCH] Update error list for zypper
|
|
|
|
Add error logging
|
|
---
|
|
salt/modules/zypper.py | 30 ++++++++++++++++++++++++++++--
|
|
1 file changed, 28 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
|
|
index e4423cf1fc..6845e44ab6 100644
|
|
--- a/salt/modules/zypper.py
|
|
+++ b/salt/modules/zypper.py
|
|
@@ -75,7 +75,25 @@ class _Zypper(object):
|
|
Allows serial zypper calls (first came, first won).
|
|
'''
|
|
|
|
- SUCCESS_EXIT_CODES = [0, 100, 101, 102, 103]
|
|
+ SUCCESS_EXIT_CODES = {
|
|
+ 0: 'Successful run of zypper with no special info.',
|
|
+ 100: 'Patches are available for installation.',
|
|
+ 101: 'Security patches are available for installation.',
|
|
+ 102: 'Installation successful, reboot required.',
|
|
+ 103: 'Installation succesful, restart of the package manager itself required.',
|
|
+ }
|
|
+
|
|
+ WARNING_EXIT_CODES = {
|
|
+ 6: 'No repositories are defined.',
|
|
+ 7: 'The ZYPP library is locked.',
|
|
+ 106: 'Some repository had to be disabled temporarily because it failed to refresh. '
|
|
+ 'You should check your repository configuration (e.g. zypper ref -f).',
|
|
+ 107: 'Installation basically succeeded, but some of the packages %post install scripts returned an error. '
|
|
+ 'These packages were successfully unpacked to disk and are registered in the rpm database, '
|
|
+ 'but due to the failed install script they may not work as expected. The failed scripts output might '
|
|
+ 'reveal what actually went wrong. Any scripts output is also logged to /var/log/zypp/history.'
|
|
+ }
|
|
+
|
|
LOCK_EXIT_CODE = 7
|
|
XML_DIRECTIVES = ['-x', '--xmlout']
|
|
ZYPPER_LOCK = '/var/run/zypp.pid'
|
|
@@ -188,7 +206,15 @@ class _Zypper(object):
|
|
|
|
:return:
|
|
'''
|
|
- return self.exit_code not in self.SUCCESS_EXIT_CODES
|
|
+ if self.exit_code:
|
|
+ msg = self.SUCCESS_EXIT_CODES.get(self.exit_code)
|
|
+ if msg:
|
|
+ log.info(msg)
|
|
+ msg = self.WARNING_EXIT_CODES.get(self.exit_code)
|
|
+ if msg:
|
|
+ log.warning(msg)
|
|
+
|
|
+ return self.exit_code not in self.SUCCESS_EXIT_CODES and self.exit_code not in self.WARNING_EXIT_CODES
|
|
|
|
def _is_lock(self):
|
|
'''
|
|
--
|
|
2.19.0
|
|
|
|
|