Commit Graph

90735 Commits

Author SHA1 Message Date
Bo Maryniuk
bba2b93e79 Remove double-stating file while generating grains 2018-02-20 16:24:31 +01:00
Bo Maryniuk
8aa0e83be6 Refactor unit test for simplicity so it does not need to be splitted in two functions 2018-02-20 15:25:54 +01:00
Bo Maryniuk
8320939f5e Add pytest 2018-02-20 15:25:19 +01:00
Bo Maryniuk
3015ed6bcb Fix unit test for testing main functionality of linux_iqn 2018-02-20 15:18:21 +01:00
Bo Maryniuk
2aa4d02677 Add unit test for linux_iqn testing, if not iscsii available 2018-02-20 15:10:11 +01:00
Bo Maryniuk
a2ba9377f6 Add unit test for grains linux_iqn when running as non-root 2018-02-20 15:03:59 +01:00
Bo Maryniuk
0df31e9e19 Handle access denied error when Master is not running as root 2018-02-20 15:03:25 +01:00
Dmitry Kuzmenko
e35bdb39d1
M2Crypto py3 unicode related fixes 2018-02-19 19:23:51 +03:00
Bo Maryniuk
43026b67da Add unit test for x509 module on function _parse_subject 2018-02-19 15:53:42 +01:00
Bo Maryniuk
efb18b87a9 Add logging to the subject parsing 2018-02-19 15:53:06 +01:00
Nicole Thomas
0e8f476a01
Merge pull request #46080 from terminalmage/salt-jenkins-844
Correct the version number in upstream pygit2 workaround
2018-02-16 16:53:52 -05:00
Erik Johnson
03b0591f06
Remove object_hook usage from (almost) all json loading
To explain this change, it's necessary to first understand the history
of `object_hook` usage in Salt.

Initially, the function used as the object hook wherever we used it was
(incorrectly) named `encode_dict`, despite the fact that the code was
*decoding* the contents of the dictionary to unicode. This function was
renamed to `decode_dict`, and a counterpart which *actually* encodes was
put in its place. At this time *most* of the `object_hook` usage was
changed so that `decode_dict` was used, but some references were left
using `encode_dict` (likely because I wasn't sure whether or not
changing them would break things).

However, if the desire is to have unicode values after loading JSON,
there is actually no need to use an object hook, since loading JSON in
Python always produces unicode results even with a POSIX locale!

[root@2719cd6224d3 /]# locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
[root@2719cd6224d3 /]# python
Python 2.7.5 (default, Nov  6 2016, 00:28:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> json.loads('{"foo": "bar"}')
{u'foo': u'bar'}
>>> json.loads('{"foo": "Д"}')
{u'foo': u'\u0414'}
>>>

Therefore, this commit removes all `object_hook` usage where
`decode_dict` was the hook being used, since it is redundant. It also
removes one use of `encode_dict` as an object hook that was still left
in code used by salt-thin.

The only `object_hook` left is in some of our ioflo code. I left the
`encode_dict` there, but _only for Python 2_, because if I remember
correctly ioflo needs str types, and encoding a string in Python 2
produces a str type.
2018-02-16 14:55:42 -06:00
Ch3LL
edc6243d1c
Patch salt.utils call for test_parse_localectl test 2018-02-16 15:26:06 -05:00
Nicole Thomas
f09db38f63
Merge pull request #46072 from rallytime/bp-46056
Back-port #46056 to oxygen.rc1
2018-02-16 14:56:56 -05:00
Erik Johnson
7b89dbb22b
Correct the version number in upstream pygit2 workaround
I used the incorrect version in my upstream bug workaround in #45892,
I missed that there was a 0.26.3 released before the bugfix was made.
This corrects that, and also fixes an incomplete comment that trailed
off in the middle of the sentence.
2018-02-16 13:21:45 -06:00
rallytime
e0a419655b
Pin tornado version in requirements file
tornado needs to be >= 4.2.1, but less that 5.0.

Tornado 5.0 is introducing backwards-incompatible changes. Therefore,
we need to pin the version of tornado in base.txt until we can fix
supporting Tornado 5.0 in Salt.

Refs #45790
2018-02-16 12:05:44 -05:00
Erik Johnson
b616ce046b
Add clarifying comments 2018-02-16 10:22:23 -06:00
Ch3LL
bd3a73dd04
Fix mac_assistive module not loading 2018-02-16 10:52:18 -05:00
rallytime
144b29f68b
Update old utils paths to new paths for oxygen 2018-02-16 10:35:22 -05:00
Bo Maryniuk
e286d6a45f Remove unnecessary variable 2018-02-16 16:33:48 +01:00
rallytime
9dfbdd1d97
Make sure ssh utils update has oxygen/unicode fixes 2018-02-16 10:33:42 -05:00
Erik Johnson
149e9edf8c
Mock the ssh.key_is_encrypted utils func 2018-02-16 10:29:30 -05:00
Erik Johnson
2a1834560d
Move ssh.key_is_encrypted to a utils module temporarily
This allows us to expose the needed functionality to Windows in the
meantime while we work to get salt/modules/ssh.py importing on Windows
for the Fluorine release.
2018-02-16 10:29:29 -05:00
twangboy
ebe3dd0d3e
Only keep ssh.py in the Windows installer 2018-02-16 10:28:10 -05:00
twangboy
789b3afbdf
Keep ssh state and execution modules in the installer 2018-02-16 10:28:10 -05:00
Erik Johnson
3fac72431f
git.latest: Fix regression with identity file usage
Unit test included
2018-02-16 10:25:25 -05:00
Bo Maryniuk
7461ed3c3b Lintfix: E0203 and attribute access 2018-02-16 15:03:52 +01:00
Bo Maryniuk
5d1740e4a0 Install ZMQ handler if <15 version 2018-02-16 13:56:38 +01:00
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
Bo Maryniuk
48b40eede9 Use ZMQ switch utility in the integration tests 2018-02-15 14:04:45 +01:00
Bo Maryniuk
85ef89c993 Use ZMQ_VERSION_INFO constant everywhere 2018-02-15 10:33:25 +01:00
Bo Maryniuk
1099ac1afa Add trace logging on ZMQ sockets communication 2018-02-15 10:18:46 +01:00
Bo Maryniuk
98a630e874 Remove duplicate code for ZMQ monitor handling 2018-02-15 10:18:26 +01:00
Bo Maryniuk
741bec031a Remove obsolete ZMQIOLoop direct instance 2018-02-15 10:02:22 +01: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