Commit Graph

22 Commits

Author SHA1 Message Date
Pedro Algarvio
da2e147e54
Always cleanup the changed environ 2019-05-09 14:13:32 +01:00
Pedro Algarvio
62574ee197
Typo 2019-05-08 13:16:52 +01:00
Daniel A. Wozniak
522599d261
Dont fail just because some random process died 2019-05-08 13:16:47 +01:00
Mathieu Parent
12ea1cc01e
git_pillar: Add tests for mountpoint parameter
(cherry picked from commit 6e2f4e471d08fcc29ce144af6dcd605b85644522)
2018-11-16 06:07:24 +01:00
Mathieu Parent
fce467e438
git_pillar: Add tests for root parameter
(cherry picked from commit 2e88b74816)
2018-11-16 06:07:24 +01:00
Mathieu Parent
ba150a5182
Don't fail on git_pillar tests when destructive tests are not enable
This fixes the following when running `python tests/runtests.py --ext-pillar`:

 --------  Tests with Errors  ------------------------------------------------------------------------------------------------------------------------
   -> tearDownClass (integration.pillar.test_git_pillar.TestGitPythonSSH)  ...........................................................................
       Traceback (most recent call last):
         File ".../salt/tests/support/gitfs.py", line 481, in tearDownClass
           if cls.case.sshd_proc is not None:
       AttributeError: 'NoneType' object has no attribute 'sshd_proc'
   ...................................................................................................................................................
   -> tearDownClass (integration.pillar.test_git_pillar.TestPygit2SSH)  ..............................................................................
       Traceback (most recent call last):
         File ".../salt/tests/support/gitfs.py", line 481, in tearDownClass
           if cls.case.sshd_proc is not None:
       AttributeError: 'NoneType' object has no attribute 'sshd_proc'
   ...................................................................................................................................................
 -----------------------------------------------------------------------------------------------------------------------------------------------------

Signed-off-by: Mathieu Parent <math.parent@gmail.com>
(cherry picked from commit 84e9fce9bb)
2018-11-16 06:07:22 +01:00
Pablo Suárez Hernández
b7af5e52c5
Test git ext_pillar across multiple repos using __env__ 2018-11-07 16:33:03 +00:00
rallytime
201031fa8a
Merge branch '2017.7' into '2018.3'
Conflicts:
  - 	doc/man/salt.7
  - 	doc/ref/configuration/minion.rst
  - 	salt/cloud/clouds/ec2.py
  - 	salt/returners/highstate_return.py
  - 	tests/support/gitfs.py
  - 	tests/unit/loader/test_loader.py
2018-08-10 13:12:14 -04:00
Erik Johnson
0441cd56ef
Add optimization_order to mocking 2018-08-08 11:22:52 -05:00
Erik Johnson
1dc6e79638
[PY3] Add unicode_literals to ext_pillar modules 2018-01-04 08:46:40 -06:00
Erik Johnson
002aa88a97
Replace yaml usage with a helper to ensure unicode is handled properly
Without allow_unicode=True, unicode characters are processed through the
str representer and on Python 2 are dumped as a Unicode code point (i.e.
a literal \u0414). This commit makes allow_unicode=True the default in
our salt.utils.yamlloader.safe_dump() helper. It also adds a new
salt.utils.yamlloader.dump() helper which wraps yaml.dump() and also
makes allow_unicode=True the default.

To make importing and using our custom yaml loader/dumper easier, a
convenience module called salt.utils.yaml has been added, which does a
wildcard import from both salt.utils.yamldumper and
salt.utils.yamlloader.

Refs to yaml.load/dump and yaml.safe_load/safe_dump have been updated to
salt.utils.yaml, to ensure that unicode is handled properly.
2018-01-03 14:14:21 -06:00
Erik Johnson
8b16300495
Fix some regressions in recent legacy git_pillar deprecation
These didn't get caught in PR 42823 because of how we invoke the
git_pillar code. Firstly, the "pillar" argument needed to stay. This is
because even though we're not using it, _external_pillar_data() is still
passing it now that git_pillar is not specially invoked there.
Secondly, since the input comes in as a list, and _external_pillar_data
uses single-asterisk expansion, the repos are passed separately when
they should be passed as a single list. To fix these issues, I've done
the following:

1. Re-introduced the "pillar" argument in git_pillar's ext_pillar
   function.
2. Changed the "pillar" variable to avoid confusion with the (unused)
   "pillar" argument being passed in.
3. Instead of git_pillar accepting the repos as a list, the ext_pillar
   function now uses single-asterisk expansion to make it conform with
   how _external_pillar_data() invokes it.
2017-09-26 16:12:55 -05:00
rallytime
5901b10c14 Remove deprecated Legacy Git Pillar code 2017-08-23 16:49:58 -04: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
rallytime
ccf790a83f Update all references for moved functions to use "files" util
- fopen
- flopen
- fpopen
- safe_rm
- is_empty
- is_fcntl_available
2017-07-18 10:31:01 -06:00
rallytime
8dfa8d1d19 Pass the fingerprint_hash_type through for gitfs sshd tests 2017-05-11 12:29:51 -06:00
Erik Johnson
f77393b80d Skip git_pillar integration tests on cent6
Cent6 has too old of a version of git to handle the make_repo func that
spawns the git repos used in these tests.
2017-05-03 16:36:36 -05:00
Erik Johnson
a94d081004 Add check for git-http-backend
This allows for more graceful test failures when the libexec dir is
different from what the test class determines it should be.
2017-05-03 15:16:16 -05:00
Erik Johnson
33515f6a14 Fix git_pillar integration tests on Arch
The location of the git-http-backend is within /usr/lib instead of
/usr/libexec.

This also uncomments a line that was commented out for troubleshooting
purposes.
2017-05-03 14:49:14 -05:00
Erik Johnson
39157b40ed Fix some git_pillar integration test failures
For some reason these were not failing when I opened #40777, but now
that the PR is merged are failing for PR builds (as well as locally in
my test env). This fixes those failures.
2017-05-01 17:13:42 -05: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