Commit Graph

1368 Commits

Author SHA1 Message Date
Erik Johnson
4ca7931655
[PY3] Update modules/states for PY3/Unicode compatibility (B)
This includes all the boto modules
2018-01-17 17:06:07 -06:00
Nicole Thomas
78ce60e4d4
Merge pull request #44977 from terminalmage/remove-more-explicit-unicode-literals
Remove more unnecessary explicit unicode literals
2018-01-14 07:55:29 -05:00
Erik Johnson
ce6fccde9c
[PY3] Add unicode_literals to states/modules (A) 2018-01-14 01:31:52 -06:00
Erik Johnson
b89efc16eb
Remove more unnecessary explicit unicode literals 2018-01-13 21:10:04 -06:00
Daniel Wallace
fdcf71a10c
fix test boto imports
Test boto imports are failing for some reason
2018-01-11 15:14:25 -07:00
Nicole Thomas
e402807cc0
Merge pull request #45332 from frogunder/fix_mac_archive_tests
fix test_archive tests for mac
2018-01-09 15:49:12 -05:00
Frode Gundersen
9edca8a6cf
fix test_archive tests for mac 2018-01-08 20:18:52 +00:00
rallytime
59076f5ee8
Merge branch '2017.7' into 'oxygen'
Conflicts:
  - salt/client/ssh/wrapper/state.py
  - salt/modules/yumpkg.py
2018-01-04 17:45:29 -05:00
Erik Johnson
002aa88a97
Replace yaml usage with a helper to ensure unicode is handled properly
Without allow_unicode=True, unicode characters are processed through the
str representer and on Python 2 are dumped as a Unicode code point (i.e.
a literal \u0414). This commit makes allow_unicode=True the default in
our salt.utils.yamlloader.safe_dump() helper. It also adds a new
salt.utils.yamlloader.dump() helper which wraps yaml.dump() and also
makes allow_unicode=True the default.

To make importing and using our custom yaml loader/dumper easier, a
convenience module called salt.utils.yaml has been added, which does a
wildcard import from both salt.utils.yamldumper and
salt.utils.yamlloader.

Refs to yaml.load/dump and yaml.safe_load/safe_dump have been updated to
salt.utils.yaml, to ensure that unicode is handled properly.
2018-01-03 14:14:21 -06:00
Daniel Wallace
fd6597a2b4
test directory that doesn't exist
sometimes /etc/grub.conf exists and is a symlink to /boot/grub/grub.conf, and
this won't do the right thing.
2017-12-29 10:19:24 -07:00
Adam Mendlik
29ef67bac2
Test pkg.uptodate with failed upgrades 2017-12-29 07:18:50 -07:00
Adam Mendlik
7c67ec39d9
Add tests for pkg.uptodate state 2017-12-29 07:18:49 -07:00
Erik Johnson
7b13a7df8b
Replace json module usage with a helper to ensure unicode content is handled properly
This adds wrappers for json.dump{,s} which disable `ensure_ascii` by
default.
2017-12-27 09:30:58 -06: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
Nicole Thomas
653ad2a224
Merge pull request #44946 from terminalmage/unicode-file
[PY3] Update file state/execution modules and associated files with unicode_literals
2017-12-14 16:26:50 -05:00
Nicole Thomas
ae8dd2e202
Merge pull request #44982 from terminalmage/docker-unicode
[PY3] Add unicode_literals to docker state/execution modules
2017-12-14 11:03:15 -05:00
Erik Johnson
5e1f75aab0
[PY3] Add unicode_literals to docker state/execution modules 2017-12-13 22:49:23 -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
Erik Johnson
6d52aeb739
Replace os.walk with a helper function
On PY2, when os.walk is invoked with a str as input, the paths in the
return data are all str types as well. This leaves undecoded unicode
data in those strings when files/dirs under the top dir that was passed
contain unicode characters in the filename.

>>> import os
>>> list(os.walk('temp'))
[('temp', [], ['\xd0\x94.txt', 'foo.txt'])]
>>> list(os.walk(u'temp'))
[(u'temp', [], [u'\u0414.txt', u'foo.txt'])]

The helper introduced here ensures that we always invoke os.walk with a
unicode top-level dir, so that we get unicode types in the return data.
2017-12-13 16:38:12 -06:00
rallytime
08c71f13e4
Merge branch '2017.7' into 'oxygen'
Conflicts:
  - doc/ref/configuration/minion.rst
  - doc/topics/thorium/index.rst
  - salt/beacons/__init__.py
  - salt/client/mixins.py
  - salt/client/ssh/wrapper/state.py
  - salt/daemons/masterapi.py
  - salt/grains/extra.py
  - salt/minion.py
  - salt/modules/cron.py
  - salt/modules/file.py
  - salt/modules/mac_user.py
  - salt/modules/napalm_network.py
  - salt/modules/state.py
  - salt/modules/win_file.py
  - salt/modules/win_pkg.py
  - salt/proxy/dummy.py
  - salt/state.py
  - salt/states/file.py
  - salt/states/lxc.py
  - salt/utils/__init__.py
  - salt/utils/schedule.py
  - tests/integration/modules/test_file.py
  - tests/integration/modules/test_groupadd.py
  - tests/integration/ssh/test_state.py
  - tests/integration/states/test_file.py
  - tests/unit/daemons/test_masterapi.py
  - tests/unit/grains/test_core.py
  - tests/unit/modules/test_disk.py
  - tests/unit/modules/test_napalm_network.py
  - tests/unit/modules/test_state.py
  - tests/unit/test_minion.py
  - tests/unit/utils/test_process.py
2017-12-11 18:24:41 -05:00
rallytime
23c5a4ca3e
Merge branch '2016.11' into '2017.7'
Conflicts:
  - salt/modules/win_pkg.py
  - salt/states/file.py
  - tests/integration/states/test_file.py
  - tests/unit/states/test_file.py
2017-12-07 17:33:03 -05:00
Gareth J. Greenaway
01dc34cf91
Merge branch 'develop' into 44606_glusterfs_peered_self_detection 2017-12-07 13:43:11 -08:00
Nicole Thomas
53eee476ac
Merge pull request #44638 from terminalmage/new-docker-hotness
Many improvements to docker network and container states
2017-12-07 15:50:55 -05:00
Tom Williams
c03112dbb0
Merge branch 'develop' into infra5980 2017-12-06 14:48:03 -05:00
Tom Williams
93de11063a INFRA-5743 - carriage return... 2017-12-06 14:47:07 -05:00
Erik Johnson
64aa4fbbec
Many improvements to docker network and container states
Much Improved Support for Docker Networking
===========================================

The `docker_network.present` state has undergone a full rewrite, which
includes the following improvements:

Full API Support for Network Management
---------------------------------------

The improvements made to input handling in the
`docker_container.running` state for 2017.7.0 have now been expanded to
docker_network.present`.  This brings with it full support for all
tunable configuration arguments.

Custom Subnets
--------------

Custom subnets can now be configured. Both IPv4 and mixed IPv4/IPv6
networks are supported.

Network Configuration in :py:func:`docker_container.running` States
-------------------------------------------------------------------

It is now possible to configure static IPv4/IPv6 addresses, as well as
links and labels.

Improved Handling of Images from Custom Registries
==================================================

Rather than attempting to parse the tag from the passed image name, Salt
will now resolve that tag down to an image ID and use that ID instead.

Due to this change, there are some backward-incompatible changes to
image management. See below for a full list of these changes.

Backward-incompatible Changes to Docker Image Management
--------------------------------------------------------

Passing image names to the following functions must now be done using separate
`repository` and `tag` arguments:

- `docker.build`
- `docker.commit`
- `docker.import`
- `docker.load`
- `docker.tag`
- `docker.sls_build`

Additionally, the `tag` argument must now be explicitly passed to the
`docker_image.present` state, unless the image is being pulled from a
docker registry.
2017-12-06 12:12:25 -06:00
Tom Williams
ef414cb2f2 INFRA-5980 - fix other unit test :) 2017-12-05 17:24:25 -05:00
Nicole Thomas
0298f99d81
Merge branch 'develop' into 44606_glusterfs_peered_self_detection 2017-12-05 16:55:15 -05:00
twangboy
0ff9fa498a
Fix test_directory 2017-12-04 14:05:54 -07:00
Erik Johnson
153bf45b03
Fix regression in file.managed when source_hash used with local file
This ensures that we enforce the passed source_hash when the source is a
file local to the minion.
2017-12-03 00:01:44 -06:00
twangboy
371e210247
Add ability to reset file system object perms 2017-12-01 16:51:18 -07:00
Erik Johnson
74a18f387f
Update orchestration unit tests 2017-11-29 15:51:53 -06:00
Georges Racinet
ebc165be45
Improving pylint score on states.glusterfs and test
the only tricky one is the shadowing of `peered` (function and local variable),
but that variable wasn't really needed.

I don't know why I get no-member errors for __salt__ and __opts__ in the
test file (read .pylintrc very quickly only).
The states modules is up to 10.0 score for me with that change
2017-11-22 21:15:34 +01:00
Georges Racinet
451fddb084 Take IPv6 into account in states.glusterfs.peered
This solves issue #44606

Resolution of the peer IP address (done to check if it is the current
minion) should not fail and return IPv6 addresses as well as IPv4.

The refactor uses functions from salt.utils.network instead of directly
calling socket.gethostbyname(), because they are already presented in
an easy to use format.
2017-11-22 20:58:54 +01:00
rallytime
1dea504f2d
Replace util path references with new ones 2017-11-22 12:44:36 -05:00
rallytime
052b13c98e
Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/cli/daemons.py
  - salt/client/ssh/__init__.py
  - salt/modules/win_pkg.py
  - salt/netapi/rest_cherrypy/app.py
  - salt/proxy/fx2.py
  - salt/utils/__init__.py
  - salt/utils/jinja.py
  - salt/utils/napalm.py
  - salt/utils/path.py
  - salt/utils/verify.py
  - tests/integration/modules/test_saltutil.py
  - tests/integration/states/test_service.py
  - tests/unit/utils/test_verify.py
2017-11-22 12:36:03 -05:00
Anita Krueger
d3c4f6026b
Adding nexus state and module including unit tests 2017-11-18 15:31:37 +00:00
Tom Williams
cedd0db97a INFRA-5980 - fix unit test 2017-11-14 11:51:16 -05:00
Mike Place
8b834e341d
Merge pull request #44288 from eradman/onlyif_unless
Report 'onlyif' and 'unless' conditions as true or false
2017-11-10 11:37:01 -07:00
twangboy
b1dfe9c3c8
Format patching with statements for easier reading 2017-11-09 14:32:21 -07:00
twangboy
ba2f2eb788
Add Erik's changes 2017-11-09 14:32:21 -07:00
twangboy
4ef1e3eb97
Fix unit.states.test_archive for Windows
Use os agnostic paths
Mock `salt.utils.which` for Windows
Handle urlparse return on Windows
2017-11-09 14:32:21 -07:00
Erik Johnson
c1b6d35c0c
Python 3 compatibility fixes for kubernetes
dict.keys() is not a list in Python 3, and base64.b64encode requires
a bytestring.
2017-11-09 15:05:43 -06:00
Erik Johnson
5932e8a8ae
Merge pull request #44407 from rallytime/merge-develop
[develop] Merge forward from 2017.7 to develop
2017-11-08 11:50:05 -08:00
rallytime
2c052e34b3
Merge branch '2017.7' into 'develop'
Conflicts:
  - .gitignore
  - salt/modules/win_lgpo.py
  - salt/utils/__init__.py
  - tests/integration/spm/test_build.py
  - tests/unit/test_pydsl.py
2017-11-05 20:28:51 -07:00
Jeff Schroeder
eaaa4dcf8e
Up the total test coverage of the kubernetes state to 54%!
* Add 100% test coverage for the kubernetes.node_label_absent state
* Add 100% test coverage for the kubernetes.namespace_present state
* Add 100% test coverage for the kubernetes.namespace_absent state
2017-11-05 20:11:25 -06:00
Jeff Schroeder
2b44f7ca85
Small formatting fixup 2017-11-05 20:11:17 -06:00
Jeff Schroeder
7039d74e90
More kubernetes state tests
* Add 100% test coverage for the kubernetes.secret_absent state
* Add 100% coverage for kubernetes.node_label_present
* Also add 'comment' to kubernetes.node_add_label
* Make the faux test objects more believable in test_kubernetes.py
2017-11-05 17:57:29 -06:00
Jeff Schroeder
2b02a46544
Add the beginning of tests for states.kubernetes and update things
* Add 100% test coverage for the kubernetes.secret_present state
* Add 100% test coverage for the kubernetes.configmap_absent state
* Add 100% test coverage for the kubernetes.configmap_present state
* Make some fields optional to kubernetes.create_secret and add examples
* Make some fields optional to kubernetes.replace_secret and add examples
* Make some fields optional to kubernetes.create_configmap and add examples
* Make some fields optional to kubernetes.replace_configmap and add examples
* Add 'comment' when a kubernetes configmap or secret is going to be replaced
* Update 'source', 'template', and 'saltenv' kwargs to defaults from the rest of the codebase
* Allow passing empty 'data' to the kubernetes.configmap_present state to remove the existing contents
2017-11-05 13:34:37 -06:00
rallytime
055b0701de
Lint fix from sloppy merge conflict resolution 2017-10-25 11:58:44 -04:00