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.
This adds a workaround for a bug fixed upstream on 2 Feb 2018, which
caused a branch or tag containing a unicode character to raise a
UnicodeDecodeError. Additionally, it changes how we handle version
analysis in salt.utils.gitfs. We should be using the LooseVersion from
salt.utils.versions instead of distutils.version.
First, `shlex.split()` will raise an exception when passed a unicode
type with unicode characters in the string. This modifies our
`shlex.split()` helper to first convert the passed string to a `str`
type, and then return a decoded copy of the result of the split.
Second, this uses our `to_unicode` helper to more gracefully decode the
stdout and stderr from the command. Unit tests have been added to
confirm that the output is properly decoded, including instances where
decoding fails because the return from the command contains binary data.
This removes the lowercase normalization and handles case-insensitive
path matches. It also combines local path and system path inspection
into a single helper function in both add() and remove(), for simplicity.
Additionally, the add/remove unit tests have been rewritten to test
a wider array of use cases.
- `salt/modules/rbenv.py`: Forces use of str types in the custom env dict
passed to `cmd.run_all`.
- `salt/modules/syslog_ng.py`: Ditches janky PATH munging in favor of
the stable and long-existing support built into cmdmod.py
- `salt/modules/win_path.py`: Forces use of str types in path
modification functions.
- `salt/states/win_path.py`: Completely rewritten. Duplicated code from
the execution module removed in favor of calls to the execution
module. Tests junked and 14 new tests written.
- `salt/utils/path.py`: The `which()` function was mistakenly modified
in 20033ee to inject the directories in the POSIX default path into
the PATH environment variable (even for Windows!). We never used the
PATH to find the executables, we simply cycled through the dirs one by
one and looked for an executable file matching the named path. The
code that modifies the path is now removed. In addition, `which()` now
uses `salt.utils.path.join()`, which gracefully handles mismatched
str and unicode directory components to prevent decode errors.
`join()` has also been simplified to use `salt.utils.data.decode()` to
normalize directory components to unicode.
Both string_escape and unicode_escape don't like unicode content. This
scraps the escape encoding and simply does a series of string
replacements to disabmibguate quotes, newlines, and tab characters.