Merge pull request #38619 from rallytime/merge-2016.11

[2016.11] Merge forward from 2016.3 to 2016.11
This commit is contained in:
Mike Place 2017-01-06 10:51:18 -07:00 committed by GitHub
commit 82e9b3d1a1
7 changed files with 40 additions and 9 deletions

View File

@ -31,7 +31,7 @@ __func_alias__ = {
log = logging.getLogger(__name__)
__virtualname__ = 'service'
__virtualname__ = 'daemontools'
VALID_SERVICE_DIRS = [
'/service',

View File

@ -16,7 +16,7 @@ import salt.ext.six as six
import salt.pillar
import salt.utils
from salt.defaults import DEFAULT_TARGET_DELIM
from salt.exceptions import CommandExecutionError
from salt.exceptions import CommandExecutionError, SaltInvocationError
__proxyenabled__ = ['*']
@ -87,6 +87,10 @@ 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):

View File

@ -101,19 +101,22 @@ def _additions_install_opensuse(**kwargs):
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])
pkgs=['make', 'gcc', kernel_devel],
concurrent=bool(__opts__.get('sudo_user')))
return ret
def _additions_install_ubuntu(**kwargs):
ret = __salt__['state.single']('pkg.installed', 'devel packages',
pkgs=['dkms', ])
pkgs=['dkms', ],
concurrent=bool(__opts__.get('sudo_user')))
return ret
def _additions_install_fedora(**kwargs):
ret = __salt__['state.single']('pkg.installed', 'devel packages',
pkgs=['dkms', 'gcc'])
pkgs=['dkms', 'gcc'],
concurrent=bool(__opts__.get('sudo_user')))
return ret

View File

@ -112,7 +112,7 @@ def _list_tables(cur):
def _create_table(cur, queue):
cmd = 'CREATE TABLE {0}(id INTEGER PRIMARY KEY, '\
cmd = 'CREATE TABLE {0}(id SERIAL PRIMARY KEY, '\
'data jsonb NOT NULL)'.format(queue)
log.debug('SQL Query: {0}'.format(cmd))
cur.execute(cmd)
@ -157,10 +157,34 @@ def list_length(queue):
return len(items)
def _queue_exists(queue):
'''
Does this queue exist
:param queue: Name of the queue
:type str
:return: True if this queue exists and
False otherwise
:rtype bool
'''
return queue in list_queues()
def handle_queue_creation(queue):
if not _queue_exists(queue):
with _conn(commit=True) as cur:
log.debug('Queue %s does not exist.'
' Creating', queue)
_create_table(cur, queue)
else:
log.debug('Queue %s already exists.', queue)
def insert(queue, items):
'''
Add an item or items to a queue
'''
handle_queue_creation(queue)
with _conn(commit=True) as cur:
if isinstance(items, dict):
items = json.dumps(items)

View File

@ -1411,7 +1411,6 @@ def extracted(name,
else:
ret['result'] = False
ret['comment'] = 'Can\'t extract content of {0}'.format(source_match)
else:
ret['result'] = True
if if_missing_path_exists:

View File

@ -507,7 +507,8 @@ def loaded(name, tag='latest', source=None, source_hash='', force=False):
__salt__['state.single']('file.managed',
name=tmp_filename,
source=source,
source_hash=source_hash)
source_hash=source_hash,
concurrent=bool(__opts__.get('sudo_user')))
changes = {}
if image_infos['status']:

View File

@ -79,7 +79,7 @@ def installed(name, # pylint: disable=C0103
Format: http://hostname[:port]
'''
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}
if ruby is not None and (__salt__['rvm.is_installed'](runas=user) or __salt__['rbenv.is_installed'](runas=user)):
if ruby is not None and not(__salt__['rvm.is_installed'](runas=user) or __salt__['rbenv.is_installed'](runas=user)):
log.warning(
'Use of argument ruby found, but neither rvm or rbenv is installed'
)