Commit Graph

84538 Commits

Author SHA1 Message Date
Erik Johnson
394a33fbb0 Update txt outputter to properly handle unicode strings
Using pprint.pformat will show the `u` prefix in the output
2017-08-08 13:33:43 -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
Nicole Thomas
22901bcdec Merge branch 'develop' into nacl_with_sealedbox 2017-08-08 13:44:06 -04:00
Nicole Thomas
c87f2d8b1c Spelling fix 2017-08-08 13:39:59 -04:00
Nicole Thomas
c000a2e027 Merge pull request #42552 from remijouannet/consul_fix
update consul module following this documentation https://www.consul.…
2017-08-08 13:36:11 -04:00
Nicole Thomas
ac752223ad Merge pull request #42784 from gtmanfred/http
only read file if ret is not a string in http.query
2017-08-08 13:20:12 -04:00
Nicole Thomas
c4104531f4 Merge pull request #42746 from amendlik/flat-roster-sdb
Resolve SDB in flat roster
2017-08-08 13:19:04 -04:00
Nicole Thomas
5ce4cba6d5 Merge pull request #42751 from carsonoid/rediscluster
Add redis cluster functionality
2017-08-08 13:18:23 -04:00
Nicole Thomas
44995b1abf Merge pull request #42794 from lomeroe/bp-42744
Backport #42744 to 2017.7
2017-08-08 13:16:30 -04:00
Melissa Michels
f5cace8054 Merge branch 'develop' into fix-file.absent-inconsistency 2017-08-08 10:48:21 -04:00
lomeroe
0acffc6df5 fix #42600 in develop
attempt to write data to regpol file even if data_to_write is empty
(i.e. no policies configured)
2017-08-08 09:03:35 -05:00
Nicole Thomas
39e9526790 Merge branch 'develop' into consul_fix 2017-08-08 10:01:37 -04:00
Nicole Thomas
6ccbcb2130 Merge branch 'develop' into rh_ip_fix 2017-08-08 09:50:35 -04:00
Nicole Thomas
23d1ac0086 Merge pull request #42667 from Glaberrd/yumpkg-install-performance
Added basic lazy loading for call list_repo_pkgs in yumpkg.install method
2017-08-08 09:49:47 -04:00
Nicole Thomas
dcf474c47c Merge pull request #42708 from cro/dont_change_args_during_memoize
Do not change the arguments of the function when memoizing
2017-08-08 09:47:01 -04:00
Nicole Thomas
293dcaddb6 Merge branch 'develop' into flat-roster-sdb 2017-08-08 09:28:53 -04:00
Nicole Thomas
aab0e3b1d0 Add blank line for linter 2017-08-08 09:27:42 -04:00
Nicole Thomas
ddb671b8fe Merge pull request #42783 from rallytime/fix-flaky-py3-test
Sort lists before comparing them in python 3 unit test
2017-08-08 09:25:14 -04:00
Glaberrd
89c7ad0d93 Merge branch 'develop' into yumpkg-install-performance 2017-08-08 09:31:14 +02:00
Mike Place
d69822fe93 Merge pull request #42721 from hibbert/allow_no_ip_sg
Allow no ip sg
2017-08-07 17:07:18 -05:00
Mike Place
d568964c96 Merge branch 'develop' into fix-file.absent-inconsistency 2017-08-07 16:24:24 -05:00
Mike Place
be5d400d90 Merge pull request #42744 from lomeroe/fix_42600
fix #42600 in develop
2017-08-07 16:16:09 -05:00
Sergey Kizunov
a0b4af4e73 Add --skip-grains option to salt-run
This will allow the user to skip grains generation and save the
2+ seconds it takes to generate grains for each call to `salt-run`.
Grains are not commonly used in runners.

Signed-off-by: Sergey Kizunov <sergey.kizunov@ni.com>
2017-08-07 16:10:24 -05:00
Mike Place
1f460da589 Merge pull request #42750 from jonlabroad/bugfix/set-correct-win32-attributes-when-extracting-zip
Set appropriate Windows file attributes during archive.extracted
2017-08-07 16:06:29 -05:00
Mike Place
75e6e45087 Merge branch 'develop' into rediscluster 2017-08-07 16:05:29 -05:00
Mike Place
bf7938fbe0 Merge pull request #42769 from terminalmage/issue42538
Fix domainname parameter input translation
2017-08-07 15:46:04 -05:00
Mike Place
1118b3e094 Merge pull request #42772 from rallytime/merge-develop
[develop] Merge forward from 2017.7 to develop
2017-08-07 15:44:50 -05:00
Daniel Wallace
d397c90e92 only read file if it is not a string 2017-08-07 14:37:42 -06:00
rallytime
998834fbac Sort lists before compairing them in python 3 unit test 2017-08-07 16:09:43 -04:00
rallytime
d707f94863 Update all other calls to "cmp" function
Some should just use the new utility function, while others can just
be compared more directly.
2017-08-07 15:38:39 -04:00
rallytime
5605104285 Add a cmp compatibility function utility
The ``cmp`` function has been removed in Python 3. This PR adds the
functionality as a salt utility, so the function can be used across
all Python versions.

Fixes #42697
2017-08-07 15:05:46 -04:00
lomeroe
22c375dc77 fix #42600 in develop
attempt to write data to regpol file even if data_to_write is empty
(i.e. no policies configured)
2017-08-07 13:49:39 -05:00
rallytime
f49da018e4 Sort lists before compairing them in python 3 unit test 2017-08-07 14:38:10 -04:00
Nicole Thomas
7bf2cdb363 Merge pull request #42388 from The-Loeki/patch-1
pillar.items pillar_env & pillar_override are never used
2017-08-07 13:51:47 -04:00
Carson Anderson
3f088c06c0 Add redis cluster functionality
Add cluster support to the redis cache and returner modules.

Signed-off-by: Carson Anderson <ca@carsonoid.net>
Signed-off-by: Scott King <scottking@sking3-ml.domo.com>
2017-08-07 11:39:52 -06:00
Nicole Thomas
9a8c9ebffc Merge pull request #42770 from rallytime/merge-2017.7.1-into-2017.7
[2017.7] Merge forward from 2017.7.1 to 2017.7
2017-08-07 12:21:44 -04:00
Nicole Thomas
c765e528d0 Merge pull request #42768 from rallytime/merge-2017.7
[2017.7] Merge forward from 2016.11 to 2017.7
2017-08-07 12:21:16 -04:00
Jonathan LaBroad
671f955583 Merge branch 'develop' into bugfix/set-correct-win32-attributes-when-extracting-zip 2017-08-07 12:07:42 -04:00
Mike Place
5dc7321533 Merge pull request #42766 from morganwillcock/windisk
Disk grain: attempt to retrieve HDD and SSD info on Windows
2017-08-07 10:03:48 -05:00
Erik Johnson
665de2d1f9 Fix domainname parameter input translation
Resolves #42538
2017-08-07 09:51:14 -05:00
rallytime
f20f3742cb Merge branch '2017.7' into 'develop'
Conflicts:
  - tests/unit/test_crypt.py
2017-08-07 10:43:06 -04:00
rallytime
6d17c9d227 Merge branch '2017.7.1' into '2017.7'
No conflicts.
2017-08-07 10:39:19 -04:00
Nicole Thomas
3f5827f61e Merge pull request #42651 from gtmanfred/2017.7
python2- prefix for fedora 26 packages
2017-08-07 10:35:04 -04:00
Nicole Thomas
3858bc99b8 Merge pull request #42650 from cachedout/fixup_42369
Fix mixins error with new yaml dumper
2017-08-07 10:19:11 -04:00
rallytime
0f75482c37 Merge branch '2016.11' into '2017.7'
Conflicts:
  - salt/modules/rabbitmq.py
  - salt/netapi/rest_cherrypy/app.py
  - salt/netapi/rest_tornado/saltnado.py
2017-08-07 09:57:03 -04:00
Glaberrd
261ec2306a Merge branch 'develop' into yumpkg-install-performance 2017-08-07 08:24:53 +02:00
Mike Place
82582f0304 Merge pull request #42174 from mcalmer/2017.7-kubernetes-cert-auth
kubernetes: provide client certificate authentication
2017-08-06 13:10:24 -05:00
Mike Place
7b2119feee Merge pull request #42669 from garethgreenaway/42642_2016_11_augeas_module_fix
[2016.11] Fixes to augeas module
2017-08-06 12:58:02 -05:00
Mike Place
ea16eb24cd Merge pull request #42658 from alektant/patch-1
Update libvirt.rst
2017-08-06 12:52:30 -05:00
Mike Place
281482ae6f Merge branch 'develop' into yumpkg-install-performance 2017-08-06 12:50:10 -05:00