We had a similar check to ensure "foo: bar" isn't loaded as a dict, this
adds a check to ensure that we only load lists when there is a leading
bracket.
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.
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.
Remove while loop that was hanging when `salt` wasn't in the path
Add salt.util.path.safe_path function to check for unsafe paths
Pass root_dir to all calls to `verify_env`
* Removed redundant import.
* No longer inheriting from LogSettingsParserTests.
* Replaced test class description with somethin meaninful.
* Fixed identation.
I've also moved the class to the bottom, since all the classes inheriting
from LogSettingsParserTests are in the block above.
This is a follow up on this PR:
https://github.com/saltstack/salt/pull/43366
Since we can get an OSError durin PIDfile deletion with non-root users, it
would make sense to also test for this. So here are the two test cases.
One with an OSError and the other one without.
These have been skipped for a while now because they didn't work
correctly. The old tests have been scrapped in favor of new ones that
test both the old and new config schema.
This makes the following changes:
1. Renames the valid_providers param in GitBase to git_providers,
allowing for a dictionary mapping provider names to their associated
classes. This allows for alternate providers to be used with a
GitBase subclass.
2. Renames the get_provider function to verify_provider to reduce
confusion with git_providers.
3. Uses super() to run a parent class' dunder init instead of invoking
the parent class directly.
This test wasn't really written with Windows in mind. Uses PATHEXT that
actually resembles a Windows environment. The test value has the correct
path seperator for Windows.
PyYAML works with and without bytestrings on PY3, and Python 3 can read
all of the test data as regular strings, so bytestrings are unnecessary
here.
This also adds use of textwrap.dedent to make the YAML easier to read,
so it can be indented away from the far left side of the line.