Commit Graph

13 Commits

Author SHA1 Message Date
Erik Johnson
58f5fde03c
Make Pillar no longer munge file_roots
Pillar and the local fileclient used to use the same class, but this
changed a few years ago with the introduction of FSClient (which enabled
non-roots fileserver backends in masterless Salt). Since Pillar is the
only thing that uses this client, there is no longer a reason to make
Pillar modify file_roots.
2018-10-10 13:10:50 -05:00
Erik Johnson
a0586748b6
Remove unused imports 2018-02-07 14:44:15 -06:00
Erik Johnson
a0f7eec7e5
Work around upstream pygit2 bug affecting unicode refs
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.
2018-02-07 12:00:44 -06:00
Erik Johnson
1dc6e79638
[PY3] Add unicode_literals to ext_pillar modules 2018-01-04 08:46:40 -06:00
Erik Johnson
3184168365 Use explicit unicode strings + break up salt.utils
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.
2017-08-08 13:33:43 -05:00
Nicole Thomas
93a31500c8 Merge branch 'develop' into pillar_top_wildcard 2017-06-07 17:05:06 -06:00
Ch3LL
0e35605f20
Skip git_pillar tests on MacOSX 2017-06-06 17:17:57 -04:00
Marlowe W
d66281bda6 pillar: fix tests 2017-05-26 13:41:21 +08:00
Erik Johnson
402be207b2 Skip Pygit2 tests until EPEL fixes pygit2/libgit2 version mismatch
We can revert this commit once they get the updated pygit2 pushed to
EPEL stable.
2017-04-28 13:25:02 -05:00
Erik Johnson
9f27f362ca Add HTTP git_pillar integration tests for pygit2
Also work around ssh auth issues in Ubuntu
2017-04-27 18:20:18 -05:00
Erik Johnson
9e6361c6c8 Add GitPython HTTP git_pillar tests 2017-04-27 00:48:24 -05:00
Erik Johnson
3881b6e0f3 Prepare git_pillar test code for adding HTTP tests
This further abstracts some of the setup and teardown code so it can be
used for git-over-http tests.

It also moves the code that was originally added to the archive
state integration tests to create a local http server into
salt.support.helpers so that it can be more easily and portably used.
2017-04-24 11:00:39 -05:00
Erik Johnson
e03698fbeb Add git_pillar integration tests
This also adds a new section to the runtests.py so that ext_pillar
integration tests can be run separately.
2017-04-20 03:51:08 -05:00