Commit Graph

1014 Commits

Author SHA1 Message Date
Nicole Thomas
3e18604d75
Merge pull request #45979 from isbm/isbm-parsers-loggerfix-unicode-rc1
Unicode/logger fix + bugfix: salt/utils/parsers
2018-02-14 10:39:24 -05:00
Nicole Thomas
e7999e260d
Merge pull request #44892 from terminalmage/yamlloader
Force Salt's YAML loader to load all strings as unicode types
2018-02-13 17:00:37 -05:00
Bo Maryniuk
8b5af58066 Fix lints 2018-02-12 18:54:23 +01:00
Bo Maryniuk
07ef909ea9 Remove unused variables, rename mixin variable to more exact name 2018-02-12 18:54:23 +01:00
Bo Maryniuk
9fa6647bd0 Refactor a unit test for calling PID file removal without the exception 2018-02-12 18:54:23 +01:00
Bo Maryniuk
fe4502b0e4 Add debug logging call to the unit test check 2018-02-12 18:54:23 +01:00
Bo Maryniuk
d9941ce1f3 Throw away unnecessary variable handling 2018-02-12 18:54:23 +01:00
Bo Maryniuk
56818045b6 Add unit test for calling PID deletion as non-root user 2018-02-12 18:54:23 +01:00
Bo Maryniuk
2f5b133149 Fix unit test to attempt remove PID file as root 2018-02-12 18:54:23 +01:00
Bo Maryniuk
3a8e43f806 Add tear-down method 2018-02-12 18:54:23 +01:00
Bo Maryniuk
7a0e3e983c Use pytest 2018-02-12 18:54:23 +01:00
Nicole Thomas
bc13ff8b48
Merge pull request #45941 from terminalmage/issue45679
Fix incorrect translation of docker port_bindings -> ports
2018-02-12 11:28:36 -05:00
Erik Johnson
29d0271b73
Don't try to sort ports when translating docker input
This sorting was done mainly for the benefit of the test suite, but
Python 3 will raise an error when you try to sort a mixture of int and
tuple types, so sorting breaks down when there are UDP ports.

Instead, this just leaves them as an unsorted list when passed to the
API, and the test suite does the sorting before the assertEqual.
2018-02-09 11:14:03 -06:00
Erik Johnson
f35d9f6fef
Fix incorrect translation of docker port_bindings -> ports
The logic which ensures that we expose ports which are being bound,
even when not explicitly configured, was done incorrectly. UDP ports
were being passed to the API as '1234/udp' instead of (1234, 'udp').
This results in the port not being exposed properly.

The logic has been corrected. Additionally both the "ports" input
translation function, as well as the post-processing code (where the
port numbers configured in port_bindings were being added) both
contained code to "fix" any ports which were configured using
'portnum/tcp', as these must be passed to the API simply as integers. To
reduce code duplication, this normalization is now only performed at the
very end of the post-processing function, after ports have been
translated, and any missing ports from the port_bindings have been
added.

The unit test for the port_bindings input translation code, which was
written based upon the same incorrect reading of the API docs that
resulted in the incorrect behavior, have been updated to confirm the
(now) correct behavior. The unit test for the ports input translation
code has been updated to reflect the new normalization behavior.

Finally, an integration test has been added to ensure that we properly
expose UDP ports which are added as part of the post-processing
function.
2018-02-08 23:22:43 -06:00
Daniel Wallace
dc91055059
Revert "Separates key_dir from cache_dir, The key files (i.e. '.root_key', '.sudo_...') must not be shared with other masters."
This reverts commit 20bf4eed1d.

This change breaks publisher_acls.

1) The key_dir's permissions are controlled by `permissive_pki_access` which is
   not required by publisher_acls.  By default, it is also changed back to 700
   each time that the salt-master restarts, so it will have to be chmodded each
   time.
2) The default directory for these keys is changed, which will break a lot of
   users publisher_acls setups on an upgrade to Oxygen, and require them to go
   back in to chmod new directories.

I was going through and switching out the key dir to default back to
/var/cache/salt/master, and allow it to be changed, and also be able to specify
that it is a sensitive dir, but once I ran across the `permissive_pki_access`
stuff, I thought it was better to just revert this change and try again against
Fluorine, since we do not have a lot of tests in this area around publisher_acl.
2018-02-08 12:55:25 -07:00
Erik Johnson
3f42a58363
Force Salt's YAML loader to load all strings as unicode types
This reduces the likelihood that non-unicode strings make their way into
Salt and cause str/unicode mismatches resulting in UnicodeDecodeErrors.
2018-02-08 09:04:49 -06:00
Erik Johnson
b4e24a69e6
Move get_context to salt.utils.stringutils
This avoids circular dependencies when salt.utils.jinja (which is
imported by salt.utils.templates) needs to use get_context()
2018-02-07 02:09:56 -06:00
Erik Johnson
f95139cae3
Add an option to silently keep data that fails to decode 2018-01-29 17:22:54 -06:00
Nicole Thomas
0fc2309cda
Merge branch 'oxygen' into win_fix_test_data 2018-01-29 13:24:03 -05:00
Erik Johnson
c34a6f72cd
SSDP PY3 compatibility fixes 2018-01-28 11:09:20 -06:00
Erik Johnson
7115cd9d39
Don't import text_type directly so it doesn't get added to lazyloader 2018-01-27 14:50:16 -06:00
Bo Maryniuk
fe99de3c0c Replace usage of str() forcing to unicode 2018-01-26 10:34:31 +01:00
Bo Maryniuk
f0c8839c1a Lintfix C0201: remove .keys() method 2018-01-26 10:34:31 +01:00
Bo Maryniuk
6144786fa8 Lintfix: W1699 (Python3 incompatibility) 2018-01-26 10:34:31 +01:00
Bo Maryniuk
ff89cd8527 Remove unused ImportError variable 2018-01-26 10:34:31 +01:00
Bo Maryniuk
f1b55e2ad0 Remove unused import 2018-01-26 10:34:31 +01:00
Bo Maryniuk
6ad6d11d97 Add unit test for timestamp error 2018-01-26 10:34:31 +01:00
Bo Maryniuk
50d3ce711e Add restriction check of log call when only general error happens 2018-01-26 10:34:31 +01:00
Bo Maryniuk
9a187bfb3a Add unit test for discovery general error handling 2018-01-26 10:34:31 +01:00
Bo Maryniuk
f700c3a870 Move helper class out of the test scope 2018-01-26 10:34:31 +01:00
Bo Maryniuk
89735d8599 Add unot test on no masters has been discovered 2018-01-26 10:34:31 +01:00
Bo Maryniuk
b4cc92e5af Rename unit test 2018-01-26 10:34:31 +01:00
Bo Maryniuk
11c8afb1f4 Update unit test for error handling 2018-01-26 10:34:31 +01:00
Bo Maryniuk
d99dc2d64e Add unit test for handling socket timeout 2018-01-26 10:34:31 +01:00
Bo Maryniuk
29bf60fca8 Add unit test for master map construction 2018-01-26 10:34:31 +01:00
Bo Maryniuk
acb4f27ac0 Lintfix: PEP8 missing whitespace 2018-01-26 10:34:31 +01:00
Bo Maryniuk
d328f7d350 Remove unused imports 2018-01-26 10:34:31 +01:00
Bo Maryniuk
7d305bb0b3 Add unit test for network query 2018-01-26 10:34:31 +01:00
Bo Maryniuk
c26e33671a Add unit test for config is detached from the passed 2018-01-26 10:34:31 +01:00
Bo Maryniuk
61aaf4008c Add unit test for the Client, config is passed 2018-01-26 10:34:31 +01:00
Bo Maryniuk
11e02bc7be Add logging assertions and refactor the order of the calls 2018-01-26 10:34:31 +01:00
Bo Maryniuk
dc7746f579 Add unit test for the server runner 2018-01-26 10:34:31 +01:00
Bo Maryniuk
8d9bea0564 Add unit test for configuration of the server starter class 2018-01-26 10:34:31 +01:00
Bo Maryniuk
a0a574e13e Add log.debug assertion check 2018-01-26 10:34:31 +01:00
Bo Maryniuk
a5f186f021 Add unit test for correct timestamp reply 2018-01-26 10:34:31 +01:00
Bo Maryniuk
dd73783f71 Remove Yoda-expression 2018-01-26 10:34:31 +01:00
Bo Maryniuk
e0ee188a19 Lintfix: too much empty lines 2018-01-26 10:34:31 +01:00
Bo Maryniuk
7e8a01e071 Add unit test for outdated timestamp with reply 2018-01-26 10:34:31 +01:00
Bo Maryniuk
6565c16be4 Add unit test for outdated timestamp at no reply 2018-01-26 10:34:31 +01:00
Bo Maryniuk
24ded041af Add unit test datagram receives wrong timestamp, replies the reason 2018-01-26 10:34:31 +01:00