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 class is designed to be used for (among other things) gitfs and git_pillar, to enforce config settings which reside in a git config file without resorting to using the git CLI.
Having a jid that is occasionally not unique (eg two processes creating
jobs at about the same time) causes problems in my usage due to
job tracking assuming unique jids. Add a config option called `unique_jid`
that will enforce unique jids, but will change the jid format by
appending an underscore and the process id.
Signed-off-by: Sergey Kizunov <sergey.kizunov@ni.com>
This makes it possible to merge the state return
for a subresource into a main state return.
This is useful for configuring e.g. alarms to go along with a resource.
When calling an incorrectly formatted wheel or runner function, we should
be raising a SaltInvocationError with a hint to check function syntax rather
that raising an Eauth authentication error.
This PR does several things:
- Adds a dictionary error return when the function syntax passed through to
`utils.minions.CkMinions.spec_check` does not match the expected `module.function`
syntax
- Handles the return of this new dictionary error (instead of previous `False` return)
wherever the spec_check function is called. This is handled up the stack in
`master.py` and `masterapi.py`.
- Reworks the runner and wheel functions in `master.py` and `masterapi.py` to
help make those functions more DRY (see `salt.auth.check_authentication` function).
- Adds tests for all of these changes (written before the runner and wheel functions
were moved to use the new salt.auth.check_authentication function) to help prevent
regressions.
- Fixes a couple of places where unit tests exposed potential stacktraces.
- Adjusts one previous unit test concerning the dictionary error change from spec_check
Moves the following functions from `salt.utils` to `salt.utils.state`:
- gen_state_tag
- search_onfail_requisites
- check_onfail_requisites
- check_state_result
Original functions have a deprecation warning added and all references
in Salt code were updated to use the new function path, including moving
some unit tests.
Moves the `get_colors` and `get_color_theme` out of `salt.utils.py`
and into a new file named `salt.utils.color.py`.
This PR moves the original functions, adds a deprecation warning to
the old function paths, and updates any references to the functions
in Salt code to the new location. This includes moving a test as well.
Through merge forwards, some of the old-style paths have made their
way into develop. This PR corrects some of these instances on the more
popular functions.
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.
This moves the following functions from salt.utils to salt.utils.versions:
- warn_until
- kwargs_warn_until
- compare_versions (as salt.utils.versions.compare)
- version_cmp
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.
This PR is part of what will be an ongoing effort to use explicit
unicode strings in Salt. Because Python 3 does not suport Python 2's raw
unicode string syntax (i.e. `ur'\d+'`), we must use
`salt.utils.locales.sdecode()` to ensure that the raw string is unicode.
However, because of how `salt/utils/__init__.py` has evolved into the
hulking monstrosity it is today, this means importing a large module in
places where it is not needed, which could negatively impact
performance. For this reason, this PR also breaks out some of the
functions from `salt/utils/__init__.py` into new/existing modules under
`salt/utils/`. The long term goal will be that the modules within this
directory do not depend on importing `salt.utils`.
A summary of the changes in this PR is as follows:
* Moves the following functions from `salt.utils` to new locations
(including a deprecation warning if invoked from `salt.utils`):
`to_bytes`, `to_str`, `to_unicode`, `str_to_num`, `is_quoted`,
`dequote`, `is_hex`, `is_bin_str`, `rand_string`,
`contains_whitespace`, `clean_kwargs`, `invalid_kwargs`, `which`,
`which_bin`, `path_join`, `shlex_split`, `rand_str`, `is_windows`,
`is_proxy`, `is_linux`, `is_darwin`, `is_sunos`, `is_smartos`,
`is_smartos_globalzone`, `is_smartos_zone`, `is_freebsd`, `is_netbsd`,
`is_openbsd`, `is_aix`
* Moves the functions already deprecated by @rallytime to the bottom of
`salt/utils/__init__.py` for better organization, so we can keep the
deprecated ones separate from the ones yet to be deprecated as we
continue to break up `salt.utils`
* Updates `salt/*.py` and all files under `salt/client/` to use explicit
unicode string literals.
* Gets rid of implicit imports of `salt.utils` (e.g. `from salt.utils
import foo` becomes `import salt.utils.foo as foo`).
* Renames the `test.rand_str` function to `test.random_hash` to more
accurately reflect what it does
* Modifies `salt.utils.stringutils.random()` (née `salt.utils.rand_string()`)
such that it returns a string matching the passed size. Previously
this function would get `size` bytes from `os.urandom()`,
base64-encode it, and return the result, which would in most cases not
be equal to the passed size.
- Moves function to new location in salt.utils.doc.py
- Adds deprecation warning to salt.utils.parse_docstring
- Moves related unit test in test_utils.py to new test_doc.py file
This will keep future IP address changes from impacting this test. It
also tests a host which returns an IPv6 address, and a host which cannot
be resolved.
Also remove unused and unnecessary behavior from this function when the
first path component is of single length. An empty first parameter to
this function will normalze to "." and result in an incorrectly-joined
result.
This does the following:
- Splits states for container/volume/image/network management into four
separate state modules.
- Preserves backward compatibility by making ``docker.image_present``
invoke ``docker_image.present``, etc.
- Changes how Salt detects that a container needs to be replaced.
Instead of comparing each passed argument to the named container's
configuration, it creates a temporary container, and compares that
container to the named container. If the two differ, then the older
container is removed, and the new one is renamed and started, becoming
the named container.
- Removes the unit tests for container management and replaces them with
integration tests.
- Adds unit tests for the new salt.utils.docker