Commit Graph

22 Commits

Author SHA1 Message Date
Erik Johnson
f59506d4cc
Update tests to reflect behavior changes 2018-10-15 10:16:44 -05:00
Daniel A. Wozniak
86e3c46959
Revert newline translation change
On windows, newlines will be CRLF since we added unix2dos to kitchen.
2018-08-21 20:43:41 -07:00
Daniel A. Wozniak
ce3ed43dab
Always use unix line endings 2018-07-30 11:41:58 -07:00
Erik Johnson
52fc1c955d
Simplify file contents in roots fileserver test
This removes the need to hard code contents in the test. The roots
fileserver just reads from the file in binary mode, so we should be able
to do the same in the test to confirm the correct behavior of the roots
backend.
2018-07-27 09:16:59 -05:00
Daniel A. Wozniak
95329acb1e
Fileserver transfers bytes 2018-07-23 13:24:47 -07:00
rallytime
398cc78224
Merge branch '2017.7' into '2018.3'
Conflicts:
  - .kitchen.yml
  - doc/topics/releases/2017.7.6.rst
  - salt/modules/timezone.py
  - tests/support/case.py
  - tests/unit/modules/test_timezone.py
2018-06-15 16:51:45 -04:00
Erik Johnson
6fe711ad76
Reverse monkeypatching after test_symlink_list finishes
On Windows, in test_symlink_list we monkeypatch the file_roots. However,
we don't ever reverse that monkeypatching.

This would not have affected other test classes, because the opts we are
monkeypatching are ones created specifically for that test class. And
due to the lexicographic order in which the tests are run,
test_symlink_list is run last. However, if we were to ever add a test to
that test class which would run after test_symlink_list, it would be
affected by the monkeypatching.
2018-06-13 09:58:29 -05:00
rallytime
3273bbdab7
Merge branch '2017.7' into '2018.3'
Conflicts:
  - doc/ref/configuration/master.rst
  - doc/ref/modules/all/index.rst
  - doc/topics/grains/index.rst
  - doc/topics/releases/2016.3.4.rst
  - doc/topics/spm/spm_formula.rst
  - doc/topics/tutorials/cron.rst
  - doc/topics/tutorials/index.rst
  - doc/topics/tutorials/stormpath.rst
  - salt/engines/slack.py
  - salt/log/handlers/fluent_mod.py
  - salt/modules/cyg.py
  - salt/modules/junos.py
  - salt/modules/namecheap_dns.py
  - salt/modules/namecheap_domains.py
  - salt/modules/namecheap_ns.py
  - salt/modules/namecheap_ssl.py
  - salt/modules/namecheap_users.py
  - salt/modules/reg.py
  - salt/modules/tomcat.py
  - salt/modules/vault.py
  - salt/modules/win_file.py
  - salt/modules/zpool.py
  - salt/output/highstate.py
  - salt/renderers/pass.py
  - salt/runners/cache.py
  - salt/states/boto_apigateway.py
  - salt/states/boto_iam.py
  - salt/states/boto_route53.py
  - salt/states/msteams.py
  - salt/states/reg.py
  - salt/states/win_iis.py
  - tests/integration/modules/test_cmdmod.py
  - tests/integration/states/test_user.py
  - tests/support/helpers.py
  - tests/unit/cloud/clouds/test_openstack.py
  - tests/unit/fileserver/test_gitfs.py
  - tests/unit/modules/test_junos.py
  - tests/unit/pillar/test_git.py
  - tests/unit/states/test_win_path.py
  - tests/unit/test_pillar.py
  - tests/unit/utils/test_format_call.py
  - tests/unit/utils/test_utils.py
  - tests/unit/utils/test_warnings.py
2018-06-01 14:54:12 -04:00
Erik Johnson
93ee5ee2b0
Fix all Sphinx warnings
Well, all but one, which we expect to see
2018-05-31 15:28:25 -05:00
rallytime
3416e398c6
Update old utils paths references to use new paths 2018-04-17 11:02:38 -04:00
rallytime
94c2a12be6
Merge branch '2017.7' into '2018.3'
Conflicts:
  - tests/integration/modules/test_state.py
  - tests/unit/templates/test_jinja.py
  - tests/unit/test_minion.py
2018-04-17 10:54:42 -04:00
Daniel A. Wozniak
25fd7c0694
fix py3 wart, encode os.linesep 2018-04-13 12:33:23 -07:00
Daniel A Wozniak
d79f1a1961
Fix fileserver roots tests 2018-04-13 10:15:13 -07:00
Erik Johnson
b5ef58c2aa
Fix salt.utils.path.os_walk for certain Python 2 versions
This helper was designed to ensure that the paths returned were all
unicode types, but on a couple platforms having the path be a unicode
type causes a traceback deep in the stdlib within posixpath.

To work around this, this commit makes the helper a generator that
simply decodes each tuple returned from os.walk as we iterate.
2018-01-23 23:03:17 -06:00
Erik Johnson
c27bb7c116
[PY3] Update fileserver for Unicode/PY3 compatibility
This adds a unicode_literals import to the fileserver code, and also ensures
that we return unicode paths from the serialized file/env list caches
(which when deserialized are still encoded str types on PY2).

It also adds a test and modifies a few other existing tests to confirm
that unicode paths/envs are returned *as unicode* in the return data.
2018-01-20 22:25:23 -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
rallytime
df693423b9 Move salt.utils.rm_rf to salt.utils.files.rm_rf
Also added a deprecation warning to utils/__init__.py and updated
all references to rm_rf in salt codebase.
2017-07-18 10:48:54 -06: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
twangboy
cdb53c2657 Set file_roots for Windows Temp 2017-06-29 13:01:10 -06:00
Pedro Algarvio
8031ac0209
Move mixins to tests.support.mixins.
The adapted config mixin get config methods are not static methods
2017-04-04 17:29:34 +01:00
Pedro Algarvio
ec7182a292
Use a temporary configuration instead 2017-04-01 18:55:48 +01:00
Pedro Algarvio
d05028e88c
These are not integration tests 2017-04-01 14:22:51 +01:00