Commit Graph

21 Commits

Author SHA1 Message Date
Pedro Algarvio
4d12ccbb1a
Show objects on assertion failure 2019-01-25 13:00:03 +00:00
rallytime
186f57eede
Merge branch '2017.7' into '2018.3'
Conflicts:
  - salt/modules/network.py
2018-09-13 17:11:18 -04:00
rallytime
0f3881ab4f
Skip flaky test on Python 3
Even with the flaky decorator, this test sometimes passes and sometimes fails.

Let's skip it for now.
2018-09-11 14:15:52 -04:00
rallytime
f7226f400f
Merge branch '2017.7' into '2018.3'
Conflicts:
  - pkg/osx/build_env.sh
  - salt/modules/win_useradd.py
  - salt/utils/yamldumper.py
  - tests/integration/modules/test_archive.py
  - tests/integration/output/test_output.py
2018-08-30 14:23:23 -04:00
rallytime
7dec9fca0c
Add flaky decorator to serializer test
Fixes https://github.com/saltstack/salt-jenkins/issues/1093
2018-08-29 11:43:11 -04:00
Erik Johnson
469d8e6e52
Fix difference between CSafeDumper and Dumper in yaml serializer test 2018-01-23 19:34:25 -06:00
Nicole Thomas
aea1a584a5
Merge pull request #45054 from AAbouZaid/toml_serializer
Add TOML serializer.
2017-12-19 10:23:22 -05:00
Erik Johnson
8cdb9ea54f
[PY3] Add print_function import to files with unicode_literals already added
This makes the 2.x usage invalid syntax and forces the use of print as a
function. This adds the import to the files which I've updated in the
last couple of days but forgot to add it.
2017-12-15 12:14:18 -06:00
Erik Johnson
1bfc53fc57
Update file state/execution modules and associated files with unicode_literals
This updates the file state and execution modules to use
unicode_literals. Since the serializers and the cmd module are touched
by the file state/exec module, those are also updated here, as well as
the cmd state module, for good measure.

Additionally, I found that salt.utils.data.decode_dict (and decode_list)
are misnamed for what they actually do. Since they *encode* the
contents, the functions should be named encode_dict and encode_list,
respectively. And we also should have counterparts which actually
decode, so I've added them. The compatibility functions from salt.utils
still use the old "decode" names to preserve backward compatibility, but
they now invoke the renamed "encode" functions in salt.utils.data. Note
that this means that the compatibility functions
salt.utils.decode_dict/list, and their cognates in salt.utils.data now
do different things, but since the move to salt.utils.data is also
happening in the Oxygen release this is as good a time as any to correct
this oversight.

I've updated the jinja filter docs to include information on the renamed
jinja filters, and also added a section on jinja filter renaming to the
Oxygen release notes. There was another filter that I renamed during the
process of moving functions from salt.utils which I did not properly
document in the release notes, so this is now included along with the
others.
2017-12-13 16:43:45 -06:00
Ahmed AbouZaid
ff7e0292c4
add test for toml serializer 2017-11-23 00:44:55 +01:00
Yagnik
2ccabe296e Add support for encrypted tag 2017-09-16 00:44:38 -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
Pedro Algarvio
9b1e55aa85
Import the full module namespace to avoid import shadowing.
https://github.com/saltstack/salt/pull/39996#issuecomment-287857698
2017-03-28 19:02:47 +01:00
Pedro Algarvio
40a64191a1
Absolute imports and A LOT of code cleanup. 2017-03-01 01:33:07 +00:00
Pedro Algarvio
3beb3fb801
Move whatever we need from salttesting to salt.
Let's drop the salttesting dependency cycle.
2017-02-28 22:52:49 +00:00
Pedro Algarvio
2a9d2beb02
The order is shady under Py3
/cc @cachedout @rallytime
2017-02-28 22:52:48 +00:00
Pedro Algarvio
15af4c9728
Test filenames conformity. Adjust for pytest. 2017-02-23 23:19:42 +00:00
Mike Place
5252ec99a9
Workaround for interference between loader test and yaml test 2016-09-30 22:28:49 +09:00
Mark McGuire
4324189658 add deserializer test, fix deserialization 2015-11-15 14:14:42 -06:00
Mark McGuire
53dd9ae138 Add configparser serializer
* move "python" serializer to serializers
* make salt.states.file.serializer load serializers from salt.serializers
2015-11-15 14:04:27 -06:00
Aneesh Agrawal
4b9311507c Add new module type for serializers from issue #22257.
Move existing serializers from salt.utils.serializers to
salt.serializers.
2015-05-28 20:03:11 -04:00