Commit Graph

91644 Commits

Author SHA1 Message Date
Zac Medico
ee4ee5b619
fire_args: fix UnboundLocalError: local variable 'tag'
Fix this exception which occurs in the exception handler
inside fire_args:

Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/salt/minion.py", line 1493, in _thread_return
    return_data = executor.execute()
  File "/usr/lib64/python2.7/site-packages/salt/executors/direct_call.py", line 28, in execute
    return self.func(*self.args, **self.kwargs)
  File "/usr/lib64/python2.7/site-packages/salt/modules/saltutil.py", line 1437, in runner
    prefix='run'
  File "/usr/lib64/python2.7/site-packages/salt/utils/event.py", line 181, in fire_args
    tag, tag_data, exc
UnboundLocalError: local variable 'tag' referenced before assignment

Fixes: https://github.com/saltstack/salt/issues/46120
2018-03-27 10:52:08 -04:00
Erik Johnson
4ce2c21824
tagify: handle integer suffix list
The following code in fire_args can put at integer in the
suffix list:

    tag_suffix = [jid, 'args']

Therefore, fix tagify to convert the integer to a string,
in order to avoid the following error:

Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/salt/minion.py", line 1493, in _thread_return
    return_data = executor.execute()
  File "/usr/lib64/python2.7/site-packages/salt/executors/direct_call.py", line 28, in execute
    return self.func(*self.args, **self.kwargs)
  File "/usr/lib64/python2.7/site-packages/salt/modules/saltutil.py", line 1437, in runner
    prefix='run'
  File "/usr/lib64/python2.7/site-packages/salt/utils/event.py", line 175, in fire_args
    tag = tagify(tag_suffix, prefix)
  File "/usr/lib64/python2.7/site-packages/salt/utils/event.py", line 203, in tagify
    return TAGPARTER.join([part for part in parts if part])
TypeError: sequence item 2: expected string, long found
2018-03-27 10:52:01 -04:00
Nicole Thomas
554400e067
Merge pull request #46709 from vutny/doc-faq-minion-master-restart
[DOC] Update FAQ about Salt self-restarting
2018-03-27 10:34:57 -04:00
Erik Johnson
dac42a672b
Performance improvement/error catching in expr_match
`fnmatch.fnmatch()` does exact matches, so checking for an exact match
is an unnecessary extra step.

Additionally, while regex errors are caught, TypeErrors are not, so the
use of non-string expressions/values will result in a traceback. This
prevents those tracebacks.
2018-03-27 09:21:46 -05:00
Nicole Thomas
3f21e9cc65
Merge pull request #46503 from psyer/fix-cmd-run-env-corrupt
Fixes stdout user environment corruption
2018-03-27 10:20:14 -04:00
Gareth J. Greenaway
042930bd3b
A couple more fixes to ensure everything works consistently under python2 and python3, adjusting things that should be bytes and things that should be strings. Updating tests to reflect changes. 2018-03-26 21:51:51 -07:00
Nicole Thomas
0faced1d54
Merge pull request #46565 from twangboy/win_fix_cmd_powershell_2018.3
Create reg salt util (2018.3)
2018-03-26 18:03:33 -04:00
Gareth J. Greenaway
926bccb4c9
A couple changes to ensure that when we're using the contents of keys that we're trying them as strings and not bytes. 2018-03-26 14:28:58 -07:00
rallytime
5102c0310c
Bump deprecation notices in nacl module & runner to Neon
These were initially marked for removal in "Fluorine", but we need
to give users 2 feature releases to update. The version that the
options will be removed in is "Neon". The related references have
been updated, as well as the relevant documentation.
2018-03-26 17:00:25 -04:00
Denys Havrysh
d0929280fc
[DOC] Update FAQ about Salt self-restarting
Fixes #5721
2018-03-26 23:38:45 +03:00
Nicole Thomas
dd52368f90
Merge pull request #46639 from terminalmage/nacl-default-path
Use the correct path for nacl certificates in Windows
2018-03-26 15:20:09 -04:00
twangboy
5ee64e9b0e
Fix lint (spelling error) 2018-03-26 13:02:53 -06:00
Nicole Thomas
ac2a6616a7
Merge pull request #46432 from twangboy/win_locales_utf8
Default to UTF-8 for templated files
2018-03-26 15:02:13 -04:00
Daniel A. Wozniak
45dce1a485
Add reg module to globals 2018-03-26 12:00:39 -07:00
Nicole Thomas
fadc5e4ba4
Merge pull request #46669 from terminalmage/pillar-merge-order
Add option to return to pre-2017.7.3 pillar include merge order
2018-03-26 15:00:27 -04:00
Nicole Thomas
6e7565f503
Merge pull request #46717 from twangboy/release-notes-windows-installer
Update the release notes to match the docs
2018-03-26 14:55:03 -04:00
twangboy
ab619be5ab
Update the release notes to match the docs 2018-03-26 12:45:44 -06:00
Nicole Thomas
b90f0d1364
Merge pull request #46711 from terminalmage/wildcard-versions-info
Add performance reminder for wildcard versions
2018-03-26 14:07:31 -04:00
Nicole Thomas
2efef52a3e
Merge pull request #46416 from dincamihai/fix-cp.push-empty-file
Fix cp.push empty file
2018-03-26 13:52:47 -04:00
Daniel A. Wozniak
09f9322981
Fix pep8 wart 2018-03-26 10:10:24 -07:00
Daniel A. Wozniak
cb5619537f
Only change what is essential for test fix
- Revert change to keep list iteration
- Fix method name typo
2018-03-26 09:55:57 -07:00
Nicole Thomas
fac114326b
Merge pull request #46705 from garethgreenaway/46672_allow_unicode_in_states
[2018.3.0rc1] Ensure event payloads are sent as Unicode
2018-03-26 12:52:28 -04:00
Daniel A. Wozniak
d9ae2abb34
Fix splling in docstring 2018-03-26 09:45:04 -07:00
Nicole Thomas
84579e7652
Merge pull request #46643 from mcalmer/fix-docker-return
fix docker return
2018-03-26 11:52:31 -04:00
Nicole Thomas
6c80d90bb6
Merge pull request #46693 from dwoz/test_smtp_return
File and Pillar roots are dictionaries
2018-03-26 11:15:37 -04:00
Nicole Thomas
9a6bc1418c
Merge pull request #46543 from dafenko/fix-add-saltenv-pillarenv-to-pillar-item
Fix missing saltenv and pillarenv in pillar.item
2018-03-26 11:05:12 -04:00
Nicole Thomas
c67afbeb36
Merge pull request #46650 from Ch3LL/nacl_test
Mirror libnacl imports in test from the nacl module
2018-03-26 10:48:39 -04:00
Nicole Thomas
03b58a01cf
Merge pull request #46645 from terminalmage/release-notes
Add Unicode / Python 3 update to 2018.3.0 release notes
2018-03-26 10:43:53 -04:00
Nicole Thomas
f776040e25
Merge pull request #46679 from vutny/doc-state-pkg
[DOC] Correct examples in `pkg` state module
2018-03-26 10:40:06 -04:00
Nicole Thomas
308c9ddfc3
Merge pull request #46661 from Kimol/2018.3-fix_chocolatey_check_remote_packages
Chocolatey - Lowered name of local and remote packages before comparing versions.
2018-03-26 10:35:38 -04:00
Erik Johnson
fc7d16f1af
Add performance reminder for wildcard versions 2018-03-26 09:18:58 -05:00
Nicole Thomas
47409eaa6e
Merge pull request #46646 from twangboy/win_fix_test_local_cache
Fix `unit.returners.test_local_cache` for Windows
2018-03-26 10:16:22 -04:00
Nicole Thomas
0c2dce0416
Merge pull request #46649 from terminalmage/issue46595
Make server_id consistent on Python 3
2018-03-26 09:58:58 -04:00
Erik Johnson
71a1d2b40a
Fix batch tests on Python 3 2018-03-26 08:56:54 -05:00
Nicole Thomas
b2e1cdad1d
Merge pull request #46670 from twangboy/win_update_build_scripts_2018.3.0rc1
Bring #46310 into 2018.3.0rc1
2018-03-26 09:23:49 -04:00
Gareth J. Greenaway
19fd2b621a
Fixing integration tests that were failing. 2018-03-25 17:39:33 -07:00
Gareth J. Greenaway
d2672f0db9
Adding issue-46672.sls for new state.py test. 2018-03-24 10:07:50 -07:00
Gareth J. Greenaway
e721168dc4
removing salt.utils.stringutils.to_unicode from output/highstate.py and adding encoding=utf-8 to events payloads. 2018-03-23 19:09:20 -07:00
Daniel A Wozniak
b40efc5db8
Windows test client fixes
- Skip IPC transport test on windows
- Add TCP transport test for windows
2018-03-23 15:36:32 -07:00
Gareth J. Greenaway
f75f801798
Ensure tname is unicode before attempting to split. Prior to this change, states that included unicode characters would error out following the run when the results were display. 2018-03-23 13:10:14 -07:00
Daniel A. Wozniak
5bf850c67f
File and Pillar roots are dictionaries
Fixes test_smtp_return test cases.
2018-03-23 11:42:14 -07:00
Ch3LL
7cda825e90
Add groupadd module integration tests for Windows 2018-03-23 13:30:22 -04:00
Mihai Dinca
980adf8253 Fix unicode handling in pkg.info_installed 2018-03-23 18:05:22 +01:00
twangboy
affa35c30d
Revert passing encoding
Use SLS_ENCODING by default
Fall back to system encoding
2018-03-23 09:59:11 -06:00
twangboy
a0ab27ef15
Merge remote-tracking branch 'dw/win_locales_utf8' into win_locales_utf8 2018-03-23 09:47:28 -06:00
twangboy
8017860dcc
Use salt.utils.to_unicode 2018-03-23 09:46:27 -06:00
twangboy
c10ed26eab
Add ability to specify encoding in sdecode 2018-03-23 09:46:27 -06:00
twangboy
8d7e2d0058
Default to utf-8 on Windows
If it fails, we'll fall back to the system codepage
2018-03-23 09:46:17 -06:00
Sergey Kizunov
c624aa4827
Make LazyLoader thread safe
Even when `multiprocessing` is set to `True`, there is a case where
multiple threads in the same process attempt to use the same LazyLoader
object. When using the reactor and reacting to an event that will call a
runner, `salt.utils.reactor.ReactWrap.runner` will invoke
`self.pool.fire_async(self.client_cache['runner'].low, args=(fun, kwargs))`
potentially multiple times, each time using a thread from
`salt.utils.process.ThreadPool`. Each thread will invoke
`salt.client.mixins.SyncClientMixin.low` which in turn will invoke its
`_low` and call `salt.utils.job.store_job`. `salt.utils.job.store_job`
will invoke the LazyLoader object for the returner.

Since the LazyLoader object is not thread safe, occasional failures will
occur which will reduce the reliability of the overall system.

Let's examine why a function such as `LazyLoader._load` is not thread safe.
Any time the GIL is released, it allows another thread to run. There are
various types of operations that could release the GIL, but in this
particular case they are file operations that happen in both
`refresh_file_mapping` and `_load_module`. Note that if you add `print`
statements, those also release the GIL (and make the problem more
frequent). In the failure case, `refresh_file_mapping` releases the
GIL, another thread loads the module, and then when the original thread
runs again it will fail when `_inner_load` runs the second time (after
`refresh_file_mapping`). The failure is because the module is already in
`self.loaded_files`, so it is skipped over and `_inner_load` returns
`False` even though the required `key` is already in `self._dict`. Since
adding in stuff like `print` statements, or other logic also adds points in
the code that allow thread switches, the most robust solution to such a
problem is to use a mutex (as opposed to rechecking if `key` now appears
in `self._dict` at certain checkpoints).

This solution adds such a mutex and uses it in key places to ensure
integrity.

Signed-off-by: Sergey Kizunov <sergey.kizunov@ni.com>
2018-03-23 08:43:55 -05:00
Denys Havrysh
4a730383bf
[DOC] Correct examples in pkg state module 2018-03-23 11:21:16 +02:00