Commit Graph

3371 Commits

Author SHA1 Message Date
Alexandru Bleotu
71b10b81f9 Added tests for salt.modules.vspere.rename_datastore 2017-09-20 06:28:26 -04:00
Jochen Breuer
d1b5ec098c Merge branch '2017.7' into improve-async-operation-handling-in-kubernetes-module 2017-09-19 10:44:31 +02:00
rallytime
9afc84091d Update which and is_windows calls to use new paths 2017-09-15 17:27:02 -04:00
Alexandru Bleotu
d9b5424aab Merge branch 'develop' into list_cluster-gh 2017-09-15 20:04:33 +01:00
Mike Place
a1b871304b Merge pull request #43345 from ribx/develop
better atom extraction from portage version string
2017-09-15 12:29:25 -06:00
Mike Place
b262695301 Merge pull request #43493 from rallytime/merge-develop
[develop] Merge forward from 2017.7 to develop
2017-09-15 12:23:09 -06:00
Alexandru Bleotu
c3d6af502b Added tests for modules.vsphere.list_cluster 2017-09-14 12:47:34 -04:00
rallytime
75abf0a2a9 Test fix: update mock util path 2017-09-14 11:01:06 -04:00
Alexandru Bleotu
15a2499d27 Added tests for salt.vsphere._get_proxy_target 2017-09-14 10:52:28 -04:00
Nicole Thomas
aee52a20e0 Lint: Add empty line at end of file 2017-09-14 09:48:09 -04:00
Robin Lutz
e1428dec5f corrected some PEP8 problems reported by jenkins 2017-09-14 14:24:54 +02:00
Nicole Thomas
f8ef7dce40 Merge pull request #43469 from alexbleotu/test_fixes-gh
Fixed several tests
2017-09-13 15:53:53 -04:00
rallytime
bfcfcd75e8 Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/fileclient.py
  - salt/loader.py
  - salt/minion.py
  - salt/modules/alternatives.py
  - salt/modules/genesis.py
  - tests/unit/modules/test_hosts.py
  - tests/unit/modules/test_ini_manage.py
2017-09-13 15:15:04 -04:00
Alexandru Bleotu
449dccdaa1 pylint 2017-09-13 05:13:01 -04:00
Alexandru Bleotu
0222a5a056 Fix to vsphere tests 2017-09-12 18:43:08 -04:00
Alexandru Bleotu
afa4921d37 Fixed vsphere tests to support the esxcluster proxy 2017-09-12 18:43:05 -04:00
Alexandru Bleotu
26710fa8fc Added tests for esxcluster execution module 2017-09-12 18:42:58 -04:00
Alexandru Bleotu
f11a618274 Fixed Linux sysctl tests to be run in a local environment 2017-09-12 18:27:28 -04:00
Alexandru Bleotu
4cadfdcb56 Updated kubernetes tests to be skipped if library is not loaded 2017-09-12 18:27:23 -04:00
ribx
b712f971f7 Merge branch 'develop' into develop 2017-09-12 11:49:29 +02:00
Mike Place
50ab79f0cb Merge pull request #43424 from twangboy/win_unit_test_hosts
Fix `unit.modules.test_hosts` for Windows
2017-09-11 15:28:41 -06:00
Mike Place
2ac185b055 Merge pull request #43439 from rallytime/merge-develop
[develop] Merge forward from 2017.7 to develop
2017-09-11 15:18:40 -06:00
Mike Place
e7a411c7f4 Merge pull request #43252 from rallytime/utils-files-moves
Move salt.utils.istextfile to salt.utils.files.is_text_file
2017-09-11 12:42:40 -06:00
rallytime
5413a5337e Lint: remove unused import 2017-09-11 14:34:20 -04:00
Mike Place
ca091bc8a4 Merge pull request #43438 from rallytime/merge-2017.7
[2017.7] Merge forward from 2016.11 to 2017.7
2017-09-11 12:33:38 -06:00
Mike Place
a9592dd3e2 Merge pull request #43320 from twangboy/win_fix_alternatives
Fix `unit.modules.test_alternatives` for Windows
2017-09-11 11:27:59 -06:00
Mike Place
9b89e49846 Merge pull request #43363 from twangboy/scratch_ini_tests
Fix `unit.modules.test_ini_manage` for Windows
2017-09-11 11:10:30 -06:00
rallytime
984fa35062 Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/key.py
  - salt/modules/mount.py
  - salt/modules/system.py
  - tests/unit/modules/test_mount.py
  - tests/unit/modules/test_pam.py
  - tests/unit/modules/test_parted.py
2017-09-11 12:55:39 -04:00
Mike Place
2964707e5d Merge pull request #43341 from ixs/fedora-rh_ip
Fix rh_ip template use for Fedora
2017-09-11 10:30:53 -06:00
rallytime
ef7b4242c3 Merge branch '2016.11' into '2017.7'
No conflicts.
2017-09-11 12:24:10 -04:00
Mike Place
9f421dde89 Merge pull request #43370 from rallytime/merge-develop
[develop] Merge forward from 2017.7 to develop
2017-09-11 09:38:20 -06:00
rallytime
e11aa7e5ef Adjust test mocking to handle __utils__['files.is_text_file'] 2017-09-11 10:25:00 -04:00
twangboy
90dcf8287c Fix unit.modules.test_hosts for Windows
Fix problem with TmpStringIO Class on Windows. The module uses this
class twice in normal operation. In Windows there's an additional run
before the real runs where it is opened with mode='w'. This causes the
data to be wiped out. So, this sets it to only save the value in the
instance to data if it is not empty.

Use the windows path to the hosts file in Windows
2017-09-08 17:21:01 -06:00
twangboy
b2cea18d13 Fix unit.modules.test_gem for Windows
Mock `salt.utils.is_windows` to return False so the test will run on
Windows
2017-09-08 15:53:07 -06:00
Alessandro -oggei- Ogier
496f14a7e7 forgot to mock the proper one 2017-09-08 21:37:09 +02:00
Nicole Thomas
97f05ff603 Merge pull request #43398 from twangboy/win_fix_test_mount
Fix `unit.modules.test_mount` for Windows
2017-09-08 09:39:28 -04:00
Nicole Thomas
6a4cc5c1b0 Merge pull request #43399 from twangboy/win_fix_test_pam
Fix `unit.modules.test_pam` for Windows
2017-09-08 09:37:49 -04:00
Nicole Thomas
2b5cfae3f8 Merge pull request #43400 from twangboy/win_unit_test_parted
Fix `unit.modules.test_parted` for Windows
2017-09-08 09:36:59 -04:00
Nicole Thomas
332deeb013 Merge pull request #43401 from twangboy/win_unit_test_pw_group
Fix `unit.modules.test_pw_group` for Windows
2017-09-08 09:35:44 -04:00
Nicole Thomas
c0f54bfef1 Merge pull request #43402 from twangboy/win_unit_test_qemu_nbd
Fix `unit.modules.test_qemu_nbd` for Windows
2017-09-08 09:34:57 -04:00
Alessandro -oggei- Ogier
70642e495d better qemu_static parameter mangle in deboostrap management, tests 2017-09-08 10:17:32 +02:00
twangboy
6ceb895a84 Use os.path.join for paths 2017-09-07 16:51:10 -06:00
twangboy
531ce8022b Fix unit.modules.test_qemu_nbd for Windows
Use os.sep
2017-09-07 15:44:35 -06:00
twangboy
78e39a1b9d Fix unit.modules.test_pw_group for Windows
Skip `test_info` and `test_getent` because they require grp which is not
available on Windows
2017-09-07 15:34:57 -06:00
twangboy
8e3e897ee2 Fix unit.modules.test_parted for Windows
Mock salt.utils.is_windows to be False so that the __virtual__ tests
will run
2017-09-07 15:27:11 -06:00
twangboy
6257aa964a Fix unit.modules.test_pam for Windows
Mocks os.path.exists
2017-09-07 15:18:14 -06:00
twangboy
4a8d7e522c Fix tests, Use full path to salt.utils.which 2017-09-07 14:41:56 -06:00
Nicole Thomas
6106aec696 Merge pull request #43356 from gtmanfred/2016.11
never-download got readded
2017-09-07 13:46:04 -04:00
Nicole Thomas
3f19b247f3 Add handler.messages back in for test comparison 2017-09-07 11:51:39 -04:00
Jochen Breuer
20619b24c4
Fixed test for delete_deployment
Due to implementation change, we need to mock the return value.
2017-09-07 10:20:46 +02:00
twangboy
a909813fa5 Remove unused import (lint) 2017-09-06 15:56:24 -06:00
twangboy
3ef8d714cb Fix unit tests to mock salt.utils.path.readlink 2017-09-06 13:03:14 -06:00
twangboy
7c4460164b Fix alternatives for Windows
Not sure this is necessary... I don't think alternatives is a thing in
Windows. Anyway, it uses `__salt__['file.readlink']` instead of
`os.readlink` as there is no `os.readlink` in Windows.
Modifies the tests to mock `__salt__['file.readlink']` instead of
`os.readlink`
2017-09-06 13:03:14 -06:00
Nicole Thomas
7d462d29c2 Merge branch 'develop' into expand-list_pkg-attr-parameter 2017-09-06 12:15:01 -04:00
Nicole Thomas
5111cf8bad Merge branch '2016.11' into 43086-no-member 2017-09-06 10:41:18 -04:00
rallytime
5701d54516 Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/state.py
  - salt/utils/gitfs.py
2017-09-06 09:39:27 -04:00
Andreas Thienemann
6aefa5c3f8 Update unit test to provide osmajorrelease grain. 2017-09-06 03:46:00 +02:00
twangboy
a94319a082 Make sure formatting of TEST_FILE_CONTENT matches original 2017-09-05 17:03:50 -06:00
twangboy
6263bc8983 Remove print statement 2017-09-05 16:48:58 -06:00
twangboy
79cd3831ae Fix empty value preserved test 2017-09-05 16:44:12 -06:00
twangboy
85997391f1 Is this handled the same on Linux and Windows 2017-09-05 16:32:43 -06:00
Mike Place
f902bd8bc9 Merge pull request #43152 from garethgreenaway/adding_custom_beacons
Adding custom beacons with beacon module
2017-09-05 15:37:39 -06:00
Mike Place
9c57869234 Merge pull request #43276 from rallytime/utils-state-moves
Move state-related utils to salt.utils.state.py
2017-09-05 14:20:08 -06:00
Daniel Wallace
9911b04208 fix test 2017-09-05 13:52:02 -06:00
rallytime
ed9b45ceaa Adjust a couple more tests to handle __utils__['state.check_result'] mocking 2017-09-05 10:11:11 -04:00
Robin Lutz
ba7d00f58e use dep_getkey for atom extraction to allow non existing versions and packages, added unit test to verify behaviour 2017-09-05 09:34:54 +02:00
Silvio Moioli
130c1b1c21 Merge branch 'develop' into expand-list_pkg-attr-parameter 2017-09-04 15:36:44 +02:00
twangboy
5bd5ea042a Fix unit.modules.test_chef for Windows
Mocks the __opts__ to contain cachedir
2017-09-01 14:49:50 -06:00
rallytime
4322f009cf Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/auth/__init__.py
  - salt/auth/ldap.py
  - salt/grains/metadata.py
  - salt/master.py
  - salt/modules/apache.py
  - salt/modules/dockermod.py
2017-09-01 16:37:29 -04:00
rallytime
d891433214 Adjust test mocking to handle __utils__['state.check_result'] 2017-09-01 16:09:59 -04:00
Mike Place
24962587bc Merge pull request #43269 from rallytime/merge-develop
[develop] Merge forward from 2017.7 to develop
2017-09-01 12:12:36 -06:00
Silvio Moioli
3dc46212cc test_yumpkg: adapt to new supported attrs 2017-08-31 16:21:26 +02:00
Silvio Moioli
7b0a7432f4 test_zypper: adapt to new supported attrs 2017-08-31 16:21:26 +02:00
William Cannon
58eef3dc2c fixed dunder usage problem in unit test 2017-08-30 17:00:27 -05:00
wcannon
c080b263d5 Merge branch 'develop' into develop 2017-08-30 15:54:57 -05:00
Nicole Thomas
479e0e06ac Merge pull request #42975 from brejoc/tests-for-kubernetes-module
Added unit tests for Kubernetes module
2017-08-30 16:30:15 -04:00
Nicole Thomas
ca7df1d4cf Merge pull request #43176 from terminalmage/issue42935
docker_image states: Handle Hub images prefixed with "docker.io/"
2017-08-30 16:08:13 -04:00
Nicole Thomas
fdad9177b5 Merge branch '2017.7' into tests-for-kubernetes-module 2017-08-30 14:47:37 -04:00
rallytime
14f5e5e023 Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/modules/augeas_cfg.py
  - salt/modules/inspectlib/collector.py
2017-08-30 12:16:28 -04:00
Nicole Thomas
ec1bedc646 Merge pull request #43254 from twangboy/win_fix_test_inspect_collector
Fix `unit.modules.test_inspect_collector` on Windows
2017-08-30 11:46:07 -04:00
Nicole Thomas
25666f88f7 Merge pull request #43251 from twangboy/win_skip_test_groupadd
Skips `unit.modules.test_groupadd` on Windows
2017-08-30 09:56:36 -04:00
twangboy
cec627a60b Skip mac tests for user and group
They use grp and pwd
2017-08-29 16:28:12 -06:00
twangboy
b401340e6c Fix unit.modules.test_inspect_collector on Windows
Uses os.sep instead of unix-style paths in the test
Uses salt.utils.path.islink() to detect symlinks instead of
os.path.islink(). os.path.islink() does not correctly detect symlinks in
Windows
Put grp and pwd imports inside a try/except block
2017-08-29 15:59:08 -06:00
twangboy
5185071d5a Skips unit.modules.test_groupadd on Windows
There is a test_win_groupadd modules for testing the win_groupadd module
on Windows.
2017-08-29 14:29:50 -06:00
rallytime
26410c662f Update some salt.utils.x paths for moved util functions
Through merge forwards, some of the old-style paths have made their
way into develop. This PR corrects some of these instances on the more
popular functions.
2017-08-29 16:24:47 -04:00
Jochen Breuer
c227cb25ad
Skipping test on ImportError
This most probably means that the Kubernetes client lib is not
installed.
2017-08-29 17:12:25 +02:00
rallytime
6fad40454a Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/modules/aptpkg.py
  - salt/utils/napalm.py
2017-08-28 09:28:41 -04:00
rallytime
3911df2f4b Merge branch '2016.11' into '2017.7'
No conflicts.
2017-08-28 09:25:49 -04:00
Jochen Breuer
bd76a870ce
Dunder vars are now defined via setup_loader_modules 2017-08-28 14:17:00 +02:00
Erik Johnson
7279f98e92 docker_image states: Handle Hub images prefixed with "docker.io/"
On some platforms, for reason which I do not yet grok, images pulled
from the Hub are prefixed with "docker.io/". This causes the
docker_image states to fail unless the user manually adds "docker.io/"
before the image name.

This commit adds a new function called "docker.resolve_tag" which
disambiguates this variance and allows images to be specified without
the "docker.io/" prefix.

Resolves #42935.
2017-08-25 00:06:28 -05:00
garethgreenaway
0186835ebf Fix docstring in test 2017-08-24 17:08:52 -05:00
garethgreenaway
a0bb654e46 Fixing lint issues 2017-08-24 12:09:29 -07:00
Gareth J. Greenaway
41790d4f28 Missing the test_add Beacon test. 2017-08-24 10:24:27 -07:00
Alessandro -oggei- Ogier
db94f3bb1c better formatting 2017-08-24 15:07:08 +02:00
Alessandro -oggei- Ogier
e5cc667762 tests: fix a leftover and simplify some parts 2017-08-24 15:04:37 +02:00
Alessandro -oggei- Ogier
13e5997457 lint 2017-08-24 12:49:39 +02:00
Alessandro -oggei- Ogier
216ced69e5 allow comma-separated pkgs lists, quote args, test deb behaviour 2017-08-24 12:00:36 +02:00
Andy Bulford
89ac3f9092 Merge branch 'develop' into add-docker-network-ipam-support 2017-08-23 23:02:07 +01:00
Mike Place
0f4d1dd767 Merge pull request #41662 from lordcirth/nfs-exports
Expand module nfs3
2017-08-23 12:19:34 -06:00
Mike Place
970003731a Merge pull request #42111 from bechtoldt/fix_ssh_auth_keys_newline
stripping whitespaces/newlines in authorized key file lines
2017-08-23 12:12:25 -06:00
Mike Place
ae5d3ffe99 Merge pull request #43013 from amendlik/kernelpkg-remove
Add kernelpkg functions to remove kernel packages
2017-08-23 11:47:58 -06:00
Erik Johnson
d5b2a0be68 Resolve image ID during container comparison
This fixes an issue where inspecting the container returns an image ID
instead of an image name, resulting in a spurious report of a changed
image. By resolving the image down to its ID for both the existing and
new containers, we ensure we're comparing ID to ID.
2017-08-23 12:23:33 -05:00
Mike Place
87c918583d Merge branch 'develop' into nfs-exports 2017-08-22 15:09:49 -06:00
Adam Mendlik
017eb849f1 Remove kernelpkg test assertions added in Python 3.6 2017-08-22 13:05:32 -06:00
Mike Place
7d52bcee46 Merge pull request #42894 from gilbsgilbs/postgres-valid-until
Add support for PostgreSQL password expiration.
2017-08-22 12:14:53 -06:00
Alessandro -oggei- Ogier
42a118ff56 fixed cmd composition and unified his making across module 2017-08-22 16:25:54 +02:00
Tarjei Husøy
1a987cb948 Fix broken negation in iptables
Introduced in 7c6ff77c and released with 2017.7.
2017-08-22 09:43:20 -04: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
Andy Bulford
49f4f990c3 Merge branch 'develop' into add-docker-network-ipam-support 2017-08-22 09:44:21 +01:00
Mike Place
3940084df9 Merge branch 'develop' into postgres-valid-until 2017-08-21 16:16:18 -06:00
Mike Place
1a531169fc Merge pull request #43088 from gtmanfred/2017.7
allow docker util to be reloaded with reload_modules
2017-08-21 16:14:36 -06:00
Mike Place
5482524270 Merge pull request #41994 from twangboy/win_unit_test_cmdmod
Fix `unit.modules.test_cmdmod` on Windows
2017-08-21 15:53:01 -06:00
Daniel Wallace
373a9a0be4 allow docker util to be reloaded with reload_modules
If we reference the actual import, the utils module won't be reloaded, but if
we use `__utils__` it can be reloaded on a pip install
2017-08-21 13:18:08 -06:00
William Cannon
e9cdbe7266 fixing pylint issues 2017-08-18 19:45:17 -05:00
William Cannon
3f490f63f5 fixes for pylint 2017-08-18 19:24:30 -05:00
William Cannon
1499314595 Merge branch 'develop' of https://github.com/saltstack/salt into salt-check-feature 2017-08-18 16:37:40 -05:00
Jochen Breuer
3c99e61637
Renamed test to match new convention 2017-08-18 15:19:34 +02:00
Jochen Breuer
caf78d206d
Fixed imports for pytest
Imports now match the new test-suite introduced in 2017.7.
2017-08-18 15:15:20 +02:00
Andrew Bulford
ec2a8a82c8 Add support for IPAM config in Docker networks
Fixes #43047
2017-08-18 13:35:48 +01:00
Adam Mendlik
f87fe54b7b Fix linter errors for kernelpkg modules and states 2017-08-17 11:27:57 -06:00
Adam Mendlik
8f575ade60 Add kernelpkg.remove function for APT-based systems 2017-08-17 11:27:57 -06:00
Adam Mendlik
5c4a5ca59a Add kernelpkg.remove function for YUM-based systems 2017-08-17 11:27:57 -06:00
Tarjei Husøy
6f19fc023c Fix broken negation in iptables
Introduced in 7c6ff77c and released with 2017.7.
2017-08-16 10:30:55 -07:00
Jochen Breuer
c8e98c8d8a Added unit tests for Kubernetes module
Added unit tests for:
    * Node listing,
    * deployment listing,
    * service listing,
    * pod listing,
    * deployment deletion and
    * deployment creation.
2017-08-16 14:51:16 +02:00
Gilbert Gilb's
08d453eb37 Fix unit tests. 2017-08-16 09:00:26 +02:00
Mike Place
f881aa5117 Merge branch 'develop' into nfs-exports 2017-08-15 13:28:12 -06:00
rallytime
c6b9ca4b9e Lint fix: add missing space 2017-08-15 14:26:44 -04:00
rallytime
a0b19bdc27 Update account id value in boto_secgroup module unit test
This value was updated in moto 1.0.0 with the following commit:

5f3fbff627
2017-08-15 14:23:00 -04:00
rallytime
60b406e088 @mock_elb needs to be changed to @mock_elb_deprecated as well 2017-08-15 14:23:00 -04:00
rallytime
6ae1111295 Replace @mock_ec2 calls with @mock_ec2_deprecated calls
moto versions >= 1.0.0 have changed the way the mocked connections through
boto are handled with the @mock_ec2 decorator. They use the boto3 connection
method. However, since we are still using boto in many places, we need to use
the new @mock_ec2_deprecated decorator instead to handle the boto connection
functions for the unit tests.

Versions of moto < 1.0.0 are not Python 3 compatible, so salt-jenkins should
be installing newer versions of moto for those tests. Unfortunately, we cannot
install an older version of moto for Python2 that use the original @mock_ec2 call
and also import the @mock_ec2_deprecated function for newer versions of moto
simultaneously as the @mock_ec2_deprecated function doesn't exist in older
versions of moto.
2017-08-15 14:22:59 -04:00
garethgreenaway
8b48341a36 Merge branch 'develop' into fixing_beacons 2017-08-15 09:00:09 -07:00
Gareth J. Greenaway
474b6dbdf8 Updating various documentation and beacons. Adding unit tests for the beacon module. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
8b507b1635 Updating twilio_txt_msg & memusage beacons to ensure list based configuration. Adding/Updating unit tests for both. Updating twilio related things to support newer version of twilio python library. 2017-08-14 12:04:37 -07:00
rallytime
78e744bda4 Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/client/mixins.py
  - salt/fileclient.py
  - salt/modules/status.py
  - tests/integration/states/test_npm.py
2017-08-14 14:21:17 -04:00
Gilbert Gilb's
3c136e3138 Add support for PostgreSQL password expiration. 2017-08-12 13:48:12 +02:00
rallytime
6a7bf99848 Lint fix: add missing space 2017-08-11 14:19:15 -04:00
rallytime
7f46603e9c Update account id value in boto_secgroup module unit test
This value was updated in moto 1.0.0 with the following commit:

5f3fbff627
2017-08-10 17:31:14 -04:00
rallytime
7c1d493fdd @mock_elb needs to be changed to @mock_elb_deprecated as well 2017-08-10 17:15:45 -04:00
rallytime
3055e17ed5 Replace @mock_ec2 calls with @mock_ec2_deprecated calls
moto versions >= 1.0.0 have changed the way the mocked connections through
boto are handled with the @mock_ec2 decorator. They use the boto3 connection
method. However, since we are still using boto in many places, we need to use
the new @mock_ec2_deprecated decorator instead to handle the boto connection
functions for the unit tests.

Versions of moto < 1.0.0 are not Python 3 compatible, so salt-jenkins should
be installing newer versions of moto for those tests. Unfortunately, we cannot
install an older version of moto for Python2 that use the original @mock_ec2 call
and also import the @mock_ec2_deprecated function for newer versions of moto
simultaneously as the @mock_ec2_deprecated function doesn't exist in older
versions of moto.
2017-08-10 16:40:11 -04:00
Nicole Thomas
e6357abdda Merge pull request #42718 from moio/yumpkg-list_pkg-attr-parameter
yumpkg.list_pkgs: add parameter for returned attribute selection
2017-08-09 16:58:02 -04:00
Silvio Moioli
5a15e53886 yumpkg.list_pkg: add/adapt tests
This includes changes to the zypper tests because of the refactoring that
affected both modules.
2017-08-09 11:43:56 +02: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
f20f3742cb Merge branch '2017.7' into 'develop'
Conflicts:
  - tests/unit/test_crypt.py
2017-08-07 10:43:06 -04:00
Mike Place
834d6c605e
Set fact gathering style to 'old' for test_junos
Without this, we stacktrace because it does not appear that setting
'gather_facts' to False prevents the library from assuming the presence
of facts. I believe this to be an upstream bug with jnpr.

Because they have listed this as being a deprecated option in the future
this may re-break in the future.
2017-08-02 23:11:52 -06:00
Mike Place
a09091a696 Merge pull request #42517 from alexbleotu/linux_acl_fixes-gh
Fixes to linux_acl.present state & cmd.run function
2017-07-31 14:44:57 -05:00
garethgreenaway
bab7503f68 Merge branch 'develop' into linux_acl_fixes-gh 2017-07-27 16:59:36 -07:00
William Cannon
e4f7603723 removed comments, updated docstrings - mostly cosmetic 2017-07-27 15:43:12 -07:00
William Cannon
e7785bf758 changed output of tests from True/False to Pass/Fail, updated unit tests 2017-07-27 14:33:16 -07:00
rallytime
9b66464fcc Merge branch '2017.7' into 'develop'
No conflicts.
2017-07-27 13:52:52 -06:00
Mike Place
2985e4c0e6 Merge pull request #42255 from twangboy/win_unit_test_win_system
Fix `unit.modules.test_win_system` for Windows
2017-07-27 14:12:41 -05:00