If the pub entry in the load is empty, we should fail authentication in open
mode. This is usually caught elsewhere for the other modes, because we would
just write it to a file, but in this case, we only write it to a file if it
actually exists, and if it is different from disk_key, so we would catch all
other options when trying to load the public key.
Fixes#46085
When the Kubernetes client is not installed, the import of
salt.modules.kubernetes will still succeed, but HAS_LIBS will be set to
False (since the library import will be covered by a try-except clause).
Therefore expect the salt.modules.kubernetes to always succeed and check
kubernetes.HAS_LIBS instead for the presence of the kubernetes library.
Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
`_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.
'a' is not a valid filetype for semanage on Centos 6.
Since "a" (all files) is the default behavior of semanage, don't specify a `--ftype` when invoking semanage.
Closes#45825
The previous logic of matching the output of `semanage fcontext --list` did not
allow for filespecs that were longer than 49 characters. This was due to the
output of the semanage tool not conforming to the expected output.
We used to expect that the after the filespec would be at least two spaces.
However, with long filespecs there is only a single space separating it and the
next field (the file type).
This modifies the regular expression that we use to match the line to accept one
or more spaces as field delimeters.
However, this causes problems when we attempt to split the three fields into a
python dictionary. We cannot use the same logic as previously of using the field
delimeter as the file type field itself can contain a space. Instead we use a
separate regular expression to parse the line into its component parts.
Fixes#45784.