mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Merge branch '2016.3' into 'carbon'
Conflicts: - salt/minion.py
This commit is contained in:
commit
3ed6190ece
@ -1985,7 +1985,6 @@ class Minion(MinionBase):
|
||||
log.debug('Forwarding salt error event tag={tag}'.format(tag=tag))
|
||||
self._fire_master(data, tag)
|
||||
elif tag.startswith('salt/auth/creds'):
|
||||
mtag, data = salt.utils.event.MinionEvent.unpack(tag)
|
||||
key = tuple(data['key'])
|
||||
log.debug('Updating auth data for {0}: {1} -> {2}'.format(
|
||||
key, salt.crypt.AsyncAuth.creds_map.get(key), data['creds']))
|
||||
|
@ -2489,7 +2489,13 @@ def group_installed(name, skip=None, include=None, **kwargs):
|
||||
if not isinstance(item, six.string_types):
|
||||
include[idx] = str(item)
|
||||
|
||||
try:
|
||||
diff = __salt__['pkg.group_diff'](name)
|
||||
except CommandExecutionError as err:
|
||||
ret['comment'] = ('An error was encountered while installing/updating '
|
||||
'group \'{0}\': {1}.'.format(name, err))
|
||||
return ret
|
||||
|
||||
mandatory = diff['mandatory']['installed'] + \
|
||||
diff['mandatory']['not installed']
|
||||
|
||||
|
@ -597,6 +597,35 @@ class PkgTest(integration.ModuleCase,
|
||||
'Package {0} is already up-to-date'.format(target)
|
||||
)
|
||||
|
||||
@requires_system_grains
|
||||
def test_group_installed_handle_missing_package_group(self, grains=None): # pylint: disable=unused-argument
|
||||
'''
|
||||
Tests that a CommandExecutionError is caught and the state returns False when
|
||||
the package group is missing. Before this fix, the state would stacktrace.
|
||||
See Issue #35819 for bug report.
|
||||
'''
|
||||
# Skip test if package manager not available
|
||||
if not pkgmgr_avail(self.run_function, self.run_function('grains.items')):
|
||||
self.skipTest('Package manager is not available')
|
||||
|
||||
# Group install not available message
|
||||
grp_install_msg = 'pkg.group_install not available for this platform'
|
||||
|
||||
# Run the pkg.group_installed state with a fake package group
|
||||
ret = self.run_state('pkg.group_installed', name='handle_missing_pkg_group',
|
||||
skip='foo-bar-baz')
|
||||
ret_comment = ret['pkg_|-handle_missing_pkg_group_|-handle_missing_pkg_group_|-group_installed']['comment']
|
||||
|
||||
# Not all package managers support group_installed. Skip this test if not supported.
|
||||
if ret_comment == grp_install_msg:
|
||||
self.skipTest(grp_install_msg)
|
||||
|
||||
# Test state should return False and should have the right comment
|
||||
self.assertSaltFalseReturn(ret)
|
||||
self.assertEqual(ret_comment, 'An error was encountered while installing/updating group '
|
||||
'\'handle_missing_pkg_group\': Group \'handle_missing_pkg_group\' '
|
||||
'not found.')
|
||||
|
||||
if __name__ == '__main__':
|
||||
from integration import run_tests
|
||||
run_tests(PkgTest)
|
||||
|
Loading…
Reference in New Issue
Block a user