Merge branch '2018.3' into merge-2018.3

This commit is contained in:
Nicole Thomas 2018-09-28 09:34:37 -04:00 committed by GitHub
commit c6b9d18d03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 3 deletions

View file

@ -74,7 +74,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'
@ -187,7 +205,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):
'''

View file

@ -10,6 +10,7 @@ import logging
import salt.loader
import salt.utils.event
import salt.utils.functools
import salt.utils.jid
from salt.exceptions import SaltInvocationError
LOGGER = logging.getLogger(__name__)
@ -110,6 +111,8 @@ def orchestrate(mods,
pillarenv = __opts__['pillarenv']
if saltenv is None and 'saltenv' in __opts__:
saltenv = __opts__['saltenv']
if orchestration_jid is None:
orchestration_jid = salt.utils.jid.gen_jid(__opts__)
running = minion.functions['state.sls'](
mods,

View file

@ -25,6 +25,7 @@ integration.test: True
# Grains addons
grains:
test_grain: cheese
grain_path: /tmp/salt-tests-tmpdir/file-grain-test
script: grail
alot: many
planets:

View file

@ -355,7 +355,6 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
file.
'''
grain_path = os.path.join(TMP, 'file-grain-test')
self.run_function('grains.set', ['grain_path', grain_path])
state_file = 'file-grainget'
self.run_function('state.sls', [state_file])