Commit Graph

33 Commits

Author SHA1 Message Date
Gareth J. Greenaway
b6afdae7c9
Fixing lint. 2018-09-07 20:17:00 -07:00
Gareth J. Greenaway
d2fb68c8ed
Fixes various tests that were failing under python 3.7. 2018-09-07 20:17:00 -07:00
Erik Johnson
b49d8df210
Fix bad copypasta in docstring 2018-08-14 13:53:29 -05:00
rallytime
d80547e0b8
Merge branch '2017.7' into 'oxygen'
Conflicts:
  - salt/fileclient.py
  - salt/grains/disks.py
  - salt/modules/cmdmod.py
  - salt/state.py
  - salt/states/file.py
  - salt/utils/gitfs.py
  - salt/utils/win_functions.py
  - tests/integration/modules/test_state.py
  - tests/unit/cache/test_localfs.py
2018-02-08 11:23:31 -05:00
kstreee
24d41f2451
Fixes base dir making logic to ensure not raising the exception when base directory already exists. 2018-02-02 09:55:08 +09:00
Erik Johnson
d6d7da5c90
Replace all usage of six.b
It can't be trusted to produce bytes, it returns unicode when a unicode
string is passed.
2018-01-24 09:17:28 -06:00
Erik Johnson
685bfbbd3e
[PY3] Add unicode_literals to cache and cli modules 2018-01-13 21:08:51 -06:00
Erik Johnson
877abb89d0
Complete the salt.utils refactor
This moves the remaining 30 functions from salt.utils to new locations.
2017-10-15 09:43:31 -05:00
rallytime
67cdfd28ad Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/cli/cp.py
  - salt/modules/testinframod.py
  - salt/states/jenkins.py
  - tests/unit/utils/test_find.py
2017-08-22 09:07:26 -04:00
Erik Johnson
f8f74a310c Update localfs cache tests to reflect changes to func naming 2017-08-17 17:19:34 -05: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
Dmitry Kuzmenko
64954d8e40 Fixed pylint errors. 2017-06-01 16:49:57 +03:00
Dmitry Kuzmenko
2ae68ee591 Added cache test.
Implemented some time ago, but forgotten.
2017-06-01 16:49:57 +03:00
Pedro Algarvio
abe608d739
Drop @patch usage 2017-04-28 13:36:42 +01:00
Nicole Thomas
4d7871e4d7 Merge pull request #40494 from rallytime/merge-develop
[develop] Merge forward from 2016.11 to develop
2017-04-05 14:15:05 -06:00
Pedro Algarvio
dcf0a55daf
Use the test run temporary path, not the system temporary path 2017-04-04 18:58:21 +01:00
rallytime
24e812add6 Merge branch '2016.11' into 'develop'
Conflicts:
  - salt/cache/__init__.py
  - salt/grains/core.py
  - salt/utils/gitfs.py
  - tests/unit/cache/test_localfs.py
  - tests/unit/modules/test_ssh.py
2017-04-03 10:17:11 -06:00
Dmitry Kuzmenko
4475d1757d In-memory minion data cache. 2017-03-31 19:38:04 +03:00
Pedro Algarvio
d397763553
Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
Pedro Algarvio
ccea1fb6a4
Proper mocking. Removed destructive tests decorator.
Creating or deleting files under a temporary directory does not apply as
a destructive test
2017-03-28 19:00:52 +01:00
dharper
e2a232921d Checking instance exists in master._get_cached_minion_data when cache.fetch returns None 2017-03-06 09:09:03 -07: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
dharper
c71753197a Checking instance exists in master._get_cached_minion_data when cache.fetch returns None 2017-02-27 09:37:37 -06:00
Pedro Algarvio
15af4c9728
Test filenames conformity. Adjust for pytest. 2017-02-23 23:19:42 +00:00
Pedro Algarvio
e16dc832b2
Code cleanup. Tests are not destructive. Py3 compat. 2017-02-23 10:40:58 +00:00
Joseph Hall
109cb62e76 Remove .p from test 2017-01-20 20:22:57 -07:00
Joseph Hall
be55b57abf One last fix 2017-01-17 10:07:25 -07:00
Joseph Hall
fc24b24998 Add correct function name 2017-01-17 08:55:58 -07:00
Joseph Hall
380abd3744 Add cachedir args to tests 2017-01-15 14:46:35 -07:00
rallytime
57d8bd36ee Pylint fix 2016-09-13 13:27:46 -06:00
rallytime
387ed8bb9f Add unit tests for salt.cache.localfs.py 2016-09-13 10:52:15 -06:00