From 8c70d7a56b046d6efe2ea5f7c5f3dfdfbffaa3ed Mon Sep 17 00:00:00 2001 From: Nicole Thomas Date: Tue, 3 May 2016 09:54:28 -0600 Subject: [PATCH 1/6] Clarify some arg docs (#32994) Fixes #26011 Also reorganizes some of the kwarg definitions so it's more clear what is documented and what docs are missing. --- salt/states/virtualenv_mod.py | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/salt/states/virtualenv_mod.py b/salt/states/virtualenv_mod.py index 47a9e2f9ec..612b0f4b44 100644 --- a/salt/states/virtualenv_mod.py +++ b/salt/states/virtualenv_mod.py @@ -55,39 +55,49 @@ 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). + + 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. + 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 From 81c0fa4d786a9cf26d0485c227b02b09dc8fb776 Mon Sep 17 00:00:00 2001 From: Adam Tengler Date: Tue, 3 May 2016 17:57:35 +0200 Subject: [PATCH 2/6] Fixed glusterfs.peered output (#32955) Fixed 'NoneType' object is not iterable and removed existing peers from newpeers list Fixes #32954 --- salt/states/glusterfs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/states/glusterfs.py b/salt/states/glusterfs.py index 73ab5428d4..a61a9e8a6d 100644 --- a/salt/states/glusterfs.py +++ b/salt/states/glusterfs.py @@ -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 From 9ca5b02b0c37fe1a3b890173bf730f35480f75ae Mon Sep 17 00:00:00 2001 From: Nicole Thomas Date: Tue, 3 May 2016 10:17:50 -0600 Subject: [PATCH 3/6] Allow batch mode to use verbose option, as well as show_jid. (#32996) Fixes #32856 --- salt/cli/batch.py | 3 +++ salt/client/__init__.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/salt/cli/batch.py b/salt/cli/batch.py index ad5248648d..12c60f8383 100644 --- a/salt/cli/batch.py +++ b/salt/cli/batch.py @@ -99,8 +99,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[] @@ -138,6 +140,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) diff --git a/salt/client/__init__.py b/salt/client/__init__.py index b8fc9a9d51..91efc60b4d 100644 --- a/salt/client/__init__.py +++ b/salt/client/__init__.py @@ -672,6 +672,7 @@ class LocalClient(object): ret='', kwarg=None, show_jid=False, + verbose=False, **kwargs): ''' Yields the individual minion returns as they come in, or None @@ -715,7 +716,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 From 4bb3ca5955bd51a929f268a09cb03ca003032e81 Mon Sep 17 00:00:00 2001 From: Shane Lee Date: Tue, 3 May 2016 10:37:52 -0600 Subject: [PATCH 4/6] Compare uid and gid instead of name and group (#32674) * Compare uid and gid instead of name and group * Gate the uid comparison --- salt/modules/file.py | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/salt/modules/file.py b/salt/modules/file.py index 21ad19edfb..79666b0d52 100644 --- a/salt/modules/file.py +++ b/salt/modules/file.py @@ -3663,13 +3663,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: @@ -3688,19 +3698,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: From 3434f44e3f4350563e0f6bfe56192a9720b85d98 Mon Sep 17 00:00:00 2001 From: David Boucha Date: Tue, 3 May 2016 14:32:11 -0600 Subject: [PATCH 5/6] Fix syndic regression (#33021) * fix tag syndic return packing * check if jid dir exists first --- salt/minion.py | 2 +- salt/returners/local_cache.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/salt/minion.py b/salt/minion.py index 560660284e..2feb330945 100644 --- a/salt/minion.py +++ b/salt/minion.py @@ -1997,7 +1997,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'] diff --git a/salt/returners/local_cache.py b/salt/returners/local_cache.py index 72ecd0dce7..d672a58f74 100644 --- a/salt/returners/local_cache.py +++ b/salt/returners/local_cache.py @@ -100,12 +100,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_: From 816f6a1fa3645a88bebbaf16e52d04afea505dd7 Mon Sep 17 00:00:00 2001 From: rallytime Date: Wed, 4 May 2016 09:21:17 -0600 Subject: [PATCH 6/6] Whitespce fix --- salt/states/virtualenv_mod.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/states/virtualenv_mod.py b/salt/states/virtualenv_mod.py index d81f404d85..45f715f9e5 100644 --- a/salt/states/virtualenv_mod.py +++ b/salt/states/virtualenv_mod.py @@ -96,7 +96,7 @@ def managed(name, no_use_wheel: False Force to not use wheel archives (requires pip>=1.4) - + pip_upgrade: False Pass `--upgrade` to `pip install`.