Merge branch '2016.3' into '2016.11'

Conflicts:
  - salt/modules/pillar.py
  - salt/states/archive.py
  - tests/integration/states/archive.py
This commit is contained in:
rallytime 2017-02-03 09:48:58 -07:00
commit 6504bb6b02
8 changed files with 74 additions and 26 deletions

View file

@ -27,7 +27,7 @@ Primary Master Configuration
Default: ``0.0.0.0`` (all interfaces)
The local interface to bind to.
The local interface to bind to, must be an IP address.
.. code-block:: yaml

View file

@ -31,7 +31,8 @@ Minion Primary Configuration
Default: ``salt``
The hostname or ipv4 of the master.
The hostname or IP address of the master. See :conf_minion:`ipv6` for IPv6
connections to the master.
Default: ``salt``
@ -75,6 +76,19 @@ The option can can also be set to a list of masters, enabling
- address2
master_type: failover
.. conf_minion:: ipv6
``ipv6``
--------
Default: ``False``
Whether the master should be connected over IPv6.
.. code-block:: yaml
ipv6: True
.. conf_minion:: master_type
``master_type``

View file

@ -669,8 +669,8 @@ Example of a complete profile:
SCSI controller 0:
type: lsilogic_sas
ide:
IDE 0
IDE 1
IDE 0: {}
IDE 1: {}
disk:
Hard disk 0:
controller: 'SCSI controller 0'

View file

@ -1124,6 +1124,10 @@ class LocalClient(object):
if raw['data']['return'] == {}:
continue
if 'return' in raw['data']['return'] and \
raw['data']['return']['return'] == {}:
continue
# if we didn't originally target the minion, lets add it to the list
if raw['data']['id'] not in minions:
minions.add(raw['data']['id'])

View file

@ -1852,11 +1852,22 @@ def prepend_root_dir(opts, path_options):
'''
root_dir = os.path.abspath(opts['root_dir'])
root_opt = opts['root_dir'].rstrip(os.sep)
def_root_dir = salt.syspaths.ROOT_DIR.rstrip(os.sep)
for path_option in path_options:
if path_option in opts:
path = opts[path_option]
if path == root_opt or path.startswith(root_opt + os.sep):
# When running testsuite, salt.syspaths.ROOT_DIR is often empty
if def_root_dir != '' and (path == def_root_dir or path.startswith(def_root_dir + os.sep)):
# Remove the default root dir so we can add the override
path = path[len(def_root_dir):]
elif path == root_opt or path.startswith(root_opt + os.sep):
# Remove relative root dir so we can add the absolute root dir
path = path[len(root_opt):]
elif os.path.isabs(path_option):
# Absolute path (not default or overriden root_dir)
# No prepending required
continue
# Prepending the root dir
opts[path_option] = salt.utils.path_join(root_dir, path)

View file

@ -10,6 +10,7 @@ import collections
# Import third party libs
import os
import copy
import logging
import yaml
import salt.ext.six as six
@ -21,6 +22,8 @@ from salt.exceptions import CommandExecutionError, SaltInvocationError
__proxyenabled__ = ['*']
log = logging.getLogger(__name__)
def get(key,
default=KeyError,
@ -91,15 +94,25 @@ def get(key,
pillar_dict = __pillar__ if saltenv is None else items(saltenv=saltenv)
if merge:
if not isinstance(default, dict):
raise SaltInvocationError(
'default must be a dictionary when merge=True'
)
ret = salt.utils.traverse_dict_and_list(pillar_dict, key, {}, delimiter)
if isinstance(ret, collections.Mapping) and \
isinstance(default, collections.Mapping):
default = copy.deepcopy(default)
return salt.utils.dictupdate.update(default, ret, merge_lists=opt_merge_lists)
if default is None:
log.debug('pillar.get: default is None, skipping merge')
else:
if not isinstance(default, dict):
raise SaltInvocationError(
'default must be a dictionary or None when merge=True'
)
ret = salt.utils.traverse_dict_and_list(
pillar_dict,
key,
{},
delimiter)
if isinstance(ret, collections.Mapping) and \
isinstance(default, collections.Mapping):
default = copy.deepcopy(default)
return salt.utils.dictupdate.update(
default,
ret,
merge_lists=opt_merge_lists)
ret = salt.utils.traverse_dict_and_list(pillar_dict,
key,

View file

@ -100,24 +100,15 @@ def _additions_install_opensuse(**kwargs):
kernel_type = re.sub(
r'^(\d|\.|-)*', '', __grains__.get('kernelrelease', ''))
kernel_devel = 'kernel-{0}-devel'.format(kernel_type)
ret = __salt__['state.single']('pkg.installed', 'devel packages',
pkgs=['make', 'gcc', kernel_devel],
concurrent=bool(__opts__.get('sudo_user')))
return ret
return __states__['pkg.installed'](None, pkgs=['make', 'gcc', kernel_devel])
def _additions_install_ubuntu(**kwargs):
ret = __salt__['state.single']('pkg.installed', 'devel packages',
pkgs=['dkms', ],
concurrent=bool(__opts__.get('sudo_user')))
return ret
return __states__['pkg.installed'](None, pkgs=['dkms', ])
def _additions_install_fedora(**kwargs):
ret = __salt__['state.single']('pkg.installed', 'devel packages',
pkgs=['dkms', 'gcc'],
concurrent=bool(__opts__.get('sudo_user')))
return ret
return __states__['pkg.installed'](None, pkgs=['dkms', 'gcc'])
def _additions_install_linux(mount_point, **kwargs):

View file

@ -93,6 +93,21 @@ class PillarModuleTestCase(TestCase):
self.assertEqual({'l2': {'l3': 42}}, res)
self.assertEqual({'l2': {'l3': 43}}, default)
def test_pillar_get_default_merge_regression_39062(self):
'''
Confirm that we do not raise an exception if default is None and
merge=True.
See https://github.com/saltstack/salt/issues/39062 for more info.
'''
pillarmod.__opts__ = {}
pillarmod.__pillar__ = {'foo': 'bar'}
self.assertEqual(
pillarmod.get(key='foo', default=None, merge=True),
'bar',
)
# gracinet: not sure this is really useful, but other test modules have this as well
if __name__ == '__main__':