Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: zypper ZYPPER_EXIT_NO_REPOS exit code #49805

Merged
merged 3 commits into from
Sep 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions salt/modules/zypper.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,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'
Expand Down Expand Up @@ -189,7 +207,15 @@ def _is_error(self):

: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):
'''
Expand Down