Merge pull request #33032 from rallytime/merge-2016.3

[2016.3] Merge forward from 2015.8 to 2016.3
This commit is contained in:
Nicole Thomas 2016-05-04 10:28:23 -06:00
commit 6c69bac56f
7 changed files with 68 additions and 27 deletions

View File

@ -111,8 +111,10 @@ class Batch(object):
if self.options:
show_jid = self.options.show_jid
show_verbose = self.options.verbose
else:
show_jid = False
show_verbose = False
# the minion tracker keeps track of responses and iterators
# - it removes finished iterators from iters[]
@ -152,6 +154,7 @@ class Batch(object):
raw=self.opts.get('raw', False),
ret=self.opts.get('return', ''),
show_jid=show_jid,
verbose=show_verbose,
**self.eauth)
# add it to our iterators and to the minion_tracker
iters.append(new_iter)

View File

@ -694,6 +694,7 @@ class LocalClient(object):
ret='',
kwarg=None,
show_jid=False,
verbose=False,
**kwargs):
'''
Yields the individual minion returns as they come in, or None
@ -737,7 +738,7 @@ class LocalClient(object):
tgt_type=expr_form,
block=False,
**kwargs):
if fn_ret and show_jid:
if fn_ret and any([show_jid, verbose]):
for minion in fn_ret.keys():
fn_ret[minion]['jid'] = pub_data['jid']
yield fn_ret

View File

@ -2273,7 +2273,7 @@ class Syndic(Minion):
if 'jid' not in event['data']:
# Not a job return
return
jdict = self.jids.setdefault(event['tag'], {})
jdict = self.jids.setdefault(event['data']['jid'], {})
if not jdict:
jdict['__fun__'] = event['data'].get('fun')
jdict['__jid__'] = event['data']['jid']

View File

@ -3750,13 +3750,23 @@ def check_perms(name, ret, user, group, mode, follow_symlinks=False):
if user:
if isinstance(user, int):
user = uid_to_user(user)
if user != perms['luser']:
if (salt.utils.is_windows() and
user_to_uid(user) != user_to_uid(perms['luser'])
) or (
not salt.utils.is_windows() and user != perms['luser']
):
perms['cuser'] = user
if group:
if isinstance(group, int):
group = gid_to_group(group)
if group != perms['lgroup']:
if (salt.utils.is_windows() and
group_to_gid(group) != group_to_gid(perms['lgroup'])
) or (
not salt.utils.is_windows() and group != perms['lgroup']
):
perms['cgroup'] = group
if 'cuser' in perms or 'cgroup' in perms:
if not __opts__['test']:
if os.path.islink(name) and not follow_symlinks:
@ -3775,19 +3785,34 @@ def check_perms(name, ret, user, group, mode, follow_symlinks=False):
if user:
if isinstance(user, int):
user = uid_to_user(user)
if user != get_user(name, follow_symlinks=follow_symlinks) and user != '':
if (salt.utils.is_windows() and
user_to_uid(user) != user_to_uid(
get_user(name, follow_symlinks=follow_symlinks)) and
user != ''
) or (
not salt.utils.is_windows() and
user != get_user(name, follow_symlinks=follow_symlinks) and
user != ''
):
if __opts__['test'] is True:
ret['changes']['user'] = user
else:
ret['result'] = False
ret['comment'].append('Failed to change user to {0}'
.format(user))
.format(user))
elif 'cuser' in perms and user != '':
ret['changes']['user'] = user
if group:
if isinstance(group, int):
group = gid_to_group(group)
if group != get_group(name, follow_symlinks=follow_symlinks) and user != '':
if (salt.utils.is_windows() and
group_to_gid(group) != group_to_gid(
get_group(name, follow_symlinks=follow_symlinks)) and
user != '') or (
not salt.utils.is_windows() and
group != get_group(name, follow_symlinks=follow_symlinks) and
user != ''
):
if __opts__['test'] is True:
ret['changes']['group'] = group
else:

View File

@ -108,12 +108,13 @@ def prep_jid(nocache=False, passed_jid=None, recurse_count=0):
# Make sure we create the jid dir, otherwise someone else is using it,
# meaning we need a new jid.
try:
os.makedirs(jid_dir_)
except OSError:
time.sleep(0.1)
if passed_jid is None:
return prep_jid(nocache=nocache, recurse_count=recurse_count+1)
if not os.path.isdir(jid_dir_):
try:
os.makedirs(jid_dir_)
except OSError:
time.sleep(0.1)
if passed_jid is None:
return prep_jid(nocache=nocache, recurse_count=recurse_count+1)
try:
with salt.utils.fopen(os.path.join(jid_dir_, 'jid'), 'wb+') as fn_:

View File

@ -89,7 +89,7 @@ def peered(name):
newpeers = __salt__['glusterfs.list_peers']()
# if newpeers was null, we know something didn't work.
if newpeers and name in newpeers or any([name in newpeers[x] for x in newpeers]):
if newpeers and name in newpeers or newpeers and any([name in newpeers[x] for x in newpeers]):
ret['result'] = True
ret['changes'] = {'new': newpeers, 'old': peers}
# In case the hostname doesn't have any periods in it

View File

@ -60,41 +60,52 @@ def managed(name,
name
Path to the virtualenv.
requirements
requirements: None
Path to a pip requirements file. If the path begins with ``salt://``
the file will be transferred from the master file server.
cwd
Path to the working directory where `pip install` is executed.
user
use_wheel: False
Prefer wheel archives (requires pip >= 1.4).
user: None
The user under which to run virtualenv and pip.
no_chown: False
When user is given, do not attempt to copy and chown a requirements file
(needed if the requirements file refers to other files via relative
paths, as the copy-and-chown procedure does not account for such files)
use_wheel : False
Prefer wheel archives (requires pip >= 1.4).
no_use_wheel : False
Force to not use wheel archives (requires pip>=1.4)
cwd: None
Path to the working directory where `pip install` is executed.
no_deps: False
Pass `--no-deps` to `pip install`.
pip_exists_action: None
Default action of pip when a path already exists: (s)witch, (i)gnore,
(w)ipe, (b)ackup
(w)ipe, (b)ackup.
proxy: None
Proxy address which is passed to `pip install`.
env_vars
env_vars: None
Set environment variables that some builds will depend on. For example,
a Python C-module may have a Makefile that needs INCLUDE_PATH set to
pick up a header file while compiling.
no_use_wheel: False
Force to not use wheel archives (requires pip>=1.4)
pip_upgrade: False
Pass `--upgrade` to `pip install`.
pip_pkgs: None
As an alternative to `requirements`, pass a list of pip packages that
should be installed.
Also accepts any kwargs that the virtualenv module will.
However, some kwargs require `- distribute: True`
Also accepts any kwargs that the virtualenv module will. However, some
kwargs, such as the ``pip`` option, require ``- distribute: True``.
.. code-block:: yaml