Commit Graph

90527 Commits

Author SHA1 Message Date
Erik Johnson
2035bc8a44
Use unicode normalization to make test work on MacOS 2018-02-15 20:27:44 -06:00
Erik Johnson
e9ddce6e26
Update unit tests to test new unicode normalization support 2018-02-15 20:27:44 -06:00
Erik Johnson
b4e30f3804
Add unicode normalization support to data/stringutils helpers
This allows for optional normalization of unicode strings, which will
make testing more reliable. In Mac OS, os.listdir() will produce certain
unicode glyphs using separate code points for the base character and
diacritic mark, while others will use a single code point to represent
the same unicode glyph.

>>> a = u'\u0065\u0301'
>>> b = u'\u00e9'
>>> print(a)
é
>>> print(b)
é
>>> a == b
False
>>> import salt.utils.stringutils
>>> salt.utils.stringutils.to_unicode(a, normalize=True) == b
True
>>>
2018-02-15 20:27:39 -06:00
Nicole Thomas
005539923f
Merge pull request #45811 from gtmanfred/oxygen.rc1
Fix ldap eauth
2018-02-15 14:04:47 -05:00
Nicole Thomas
cb565b1520
Merge pull request #46039 from terminalmage/fix-duplicate-extra-opts-oxygen.rc1
Port #45991 to Oxygen.rc1
2018-02-15 13:53:52 -05:00
Nicole Thomas
04d73142fa
Merge pull request #46038 from rallytime/bp-46000
Back-port #46000 to oxygen.rc1
2018-02-15 11:10:47 -05:00
David Murphy
da2fc81e2e
Merge pull request #46035 from terminalmage/distutils-fix
setup.py: Work around bad code in distutils
2018-02-14 17:12:25 -07:00
David Murphy
f91289ed3b
Merge branch 'oxygen.rc1' into distutils-fix 2018-02-14 15:08:45 -07:00
Erik Johnson
160dcc4ca0
Appease pylint 2018-02-14 14:52:22 -06:00
Nicole Thomas
bcc1dda78f
Merge pull request #46008 from gtmanfred/rc1
Backport #45981 to oxygen.rc1
2018-02-14 15:28:46 -05:00
Erik Johnson
ee6bf2e634
yumpkg: Fix a couple issues with _get_extra_opts
`_get_extra_opts()` and `_get_branch_option()` were unnecessarily
quoting the value, causing it to be interpreted as a literal quote by
`subprocess.Popen()`.

Also, because there were separate helpers for repo options,
disableexcludes, branch options, and extra options, and specifically
because `_get_extra_opts()` parses *all* kwargs, any of the options from
the other helper funcs would end up being added to the command line
twice if `_get_extra_opts()` was used.

This commit consolidates all of the kwarg inspection and CLI opts
construction to a single helper function. It also adds unit tests to
make sure that we are formatting our commands properly.

Additionally, it makes a minor fix in `refresh_db()` which was not
accounted for when we changed the osmajorrelease grain to an integer in
2017.7.0.
2018-02-14 13:36:57 -06:00
Erik Johnson
10a763d448
salt.states.reg.present: Prevent traceback when reg data is binary
This prevents a failed decode of undecodable data from resulting in a
traceback by catching the exception and just using the original value in
the changes dict.
2018-02-14 14:25:41 -05:00
Erik Johnson
61b90bc4bf
setup.py: Work around bad code in distutils
While running an sdist, distutils logs when it creates paths. However,
if the paths are unicode _and_ contain unicode code points, the log
message results in a `UnicodeEncodeError` as distutils attempts to
perform string replacement using a str format string and a unicode path.

Paths recently added in the test suite's files to test unicode
compatibility have caused this issue to surface.

This fixes the resulting traceback by ensuring that Python 2 only passes
utf-8 encoded bytestrings when making the release tree.
2018-02-14 11:43:06 -06:00
Nicole Thomas
1a50abb3b4
Merge pull request #46032 from DSRCorporation/bugs/45956_sigint_traceback
Workaroung python bug in traceback.format_exc()
2018-02-14 11:58:57 -05:00
Daniel Wallace
0aaa528a6c
apparently local is not set by default 2018-02-14 09:51:15 -07:00
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
Dmitry Kuzmenko
5a3316ea20
Workaroung python bug in traceback.format_exc()
The function raises an AttributeError if there is no current exception.
https://bugs.python.org/issue23003
2018-02-14 16:16:57 +03: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
Erik Johnson
9d004f6512 Use mock 2.0.0 instead of unittest.mock on Python 3 (#2)
This preserves the custom mock_open we backported from unittest.mock,
but otherwise ditches unittest.mock as it does not have
MagicMock.assert_called in Python releases before 3.6.

This allows us to maintain a uniform mock version across all platforms
and Python releases.
2018-02-13 20:16:03 +01:00
Nicole Thomas
d72cf1dd6f
Merge pull request #45997 from garethgreenaway/2557_schedule_fixes_once
[oxygen.rc1] scheduler once fixes
2018-02-13 11:18:06 -05:00
Daniel Wallace
53443f4803
use local config for vault when masterless 2018-02-13 08:58:53 -07:00
Daniel Wallace
1c349d4d9d
fix pylint 2018-02-13 07:45:13 -07:00
Nicole Thomas
280bd8d862
Merge pull request #45990 from gtmanfred/rootdir
fix rootdir prepending on windows
2018-02-13 08:59:44 -05:00
Nicole Thomas
175c8be882
Merge pull request #45999 from terminalmage/issue45960
Properly handle undecodable bytestrings in nested outputter
2018-02-13 08:43:56 -05:00
Erik Johnson
6cb1a38407
Properly handle undecodable bytestrings in nested outputter
Note however that these bytestrings will typically end up being
whitespace when printed. But, at least they will no longer result in a
traceback.
2018-02-12 22:35:45 -06:00
Gareth J. Greenaway
b752775c44
A couple bug fixes in the scheduler when once is used for the job run time. 2018-02-12 20:21:16 -08:00
Daniel Wallace
9e98f9dcdb
fix rootdir prepending on windows 2018-02-12 15:36:27 -07:00
Gareth J. Greenaway
d17cb93b27
Merge pull request #45989 from rallytime/bp-45984
Back-port #45984 to oxygen.rc1
2018-02-12 14:27:45 -08:00
Gareth J. Greenaway
a8c2cd8066
Missing format in the call to write. 2018-02-12 17:26:10 -05:00
Daniel Wallace
472ed2ee9a
fix class for pylint 2018-02-12 14:31:33 -07:00
Daniel Wallace
f7aa2b9266
fix pylint 2018-02-12 14:25:17 -07:00
Daniel Wallace
4d4a2f4790
move Bind to outside of functions 2018-02-12 14:25:17 -07:00
Daniel Wallace
b0fb3d6786
add ldap tests 2018-02-12 14:25:17 -07:00
Daniel Wallace
4a7ec7c57b
fix lint issues 2018-02-12 14:25:17 -07:00
Daniel Wallace
191495cea0
clean up strs 2018-02-12 14:25:17 -07:00
Daniel Wallace
c3f1587fdb
fix unicode in ldap eauth 2018-02-12 14:25:16 -07:00
Adam Mendlik
bcfd4dfbd4
Allow authinticatied bind for listing LDAP groups 2018-02-12 14:25:16 -07:00
Adam Mendlik
561ae2725d
Log an error if python-ldap is not installed and ldap auth is used 2018-02-12 14:25:16 -07:00
Nicole Thomas
ff6a8d6df9
Merge pull request #45937 from twangboy/win_fix_pkg_unicode
Fix Py2 unicode issue in win_pkg.py
2018-02-12 15:21:14 -05:00
Bo Maryniuk
888939116a Drop forcing to unicode exception object 2018-02-12 18:55:55 +01: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
06158e4242 Remove unnecessary string on get->return 2018-02-12 18:54:23 +01:00
Bo Maryniuk
2908422539 Add debugging information to the log 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