Commit Graph

182 Commits

Author SHA1 Message Date
Erik Johnson
db11317400
Add ability to run a shell command to depends decorator
This adds the ability to suppress loading of a function based on the
retcode of a command.
2018-04-12 18:02:21 -05:00
rallytime
5b50eaf6b0
Merge branch '2018.3' into 'develop'
Conflicts:
  - doc/ref/proxy/all/salt.proxy.cimc.rst
  - doc/ref/proxy/all/salt.proxy.panos.rst
  - doc/topics/releases/2018.3.0.rst
  - salt/modules/cmdmod.py
  - salt/modules/state.py
  - salt/utils/schedule.py
  - tests/integration/modules/test_state.py
2018-04-05 13:25:46 -04:00
rallytime
893196d3e6
Merge branch '2017.7' into '2018.3'
Conflicts:
  - doc/conf.py
  - salt/loader.py
  - salt/modules/dockermod.py
  - salt/modules/sensehat.py
  - salt/utils/parsers.py
  - tests/integration/cloud/providers/test_ec2.py
  - tests/integration/modules/test_cp.py
  - tests/integration/modules/test_groupadd.py
  - tests/integration/spm/test_man_spm.py
  - tests/integration/states/test_npm.py
  - tests/unit/states/test_environ.py
2018-04-03 14:33:11 -04:00
Daniel A. Wozniak
5c22a0f88d
Use aboslute imports 2018-03-28 22:32:30 -07:00
Daniel A. Wozniak
78c9cb9584
Fix TestResult constructor calls 2018-03-28 21:09:59 -07:00
Daniel A. Wozniak
5ac89ad307
Use winrm_verify_ssl option causing tests to pass 2018-03-28 20:21:40 -07:00
Daniel A. Wozniak
ba5f11476c
Adding windows minion tests for salt cloud 2018-03-28 15:16:54 -07:00
Daniel A. Wozniak
4cb0c3f228
Failfast will be '-F' instead of '-f'
Avoid potential confusion with '-f' for '--force'
2018-03-21 20:31:25 -07:00
Daniel A. Wozniak
641f1f2293
Add fail-fast option to test runner 2018-03-20 22:53:01 -07:00
Erik Johnson
f9f187e915
Improve reliability/idempotence of file.blockreplace state
This makes the following changes:

- The `append_newline` argument to the `file.blockreplace`
  remote-execution function has been modified so that if its value is
  `None`, it only appends a newline when the content block does not end
  in one.
- A couple of fixes were made to newline handling. The existing code
  normalized the newlines in the content block, replacing them with
  os.linesep. However, when the file contains newlines that don't match
  the OS (i.e. POSIX newlines in a file on a Windows box, or Windows
  newlines on a Linux/Mac/BSD/etc. box), then we would still end up with
  mixed newlines. The line separator is now detected when we read in the
  original file, and the detected line separator is used when writing
  the content block. Additionally, the same newline mismatch was
  possible when appending/prepending the content block. This has been
  fixed by using a common function for appending, prepending, and
  replacing the content block.
- Support for the `append_newline` argument has been added to the
  `file.blockreplace` state. The default value for the state is `None`.
  A `versionchanged` has been added to the remote execution function to
  let users know that the Fluorine release will change the default value
  of that variable.
- 20 new integration tests have been written to test the
  `file.blockreplace` state.
2018-03-07 22:29:39 -06:00
Erik Johnson
4798187035
Improve reliability/idempotence of file.blockreplace state (2018.3 branch)
This makes the following changes:

- The `append_newline` argument to the `file.blockreplace`
  remote-execution function has been modified so that if its value is
  `None`, it only appends a newline when the content block does not end
  in one.
- A couple of fixes were made to newline handling. The existing code
  normalized the newlines in the content block, replacing them with
  os.linesep. However, when the file contains newlines that don't match
  the OS (i.e. POSIX newlines in a file on a Windows box, or Windows
  newlines on a Linux/Mac/BSD/etc. box), then we would still end up with
  mixed newlines. The line separator is now detected when we read in the
  original file, and the detected line separator is used when writing
  the content block. Additionally, the same newline mismatch was
  possible when appending/prepending the content block. This has been
  fixed by using a common function for appending, prepending, and
  replacing the content block.
- Support for the `append_newline` argument has been added to the
  `file.blockreplace` state. The default value for the state is `None`.
  A `versionchanged` has been added to the remote execution function to
  let users know that the Fluorine release will change the default value
  of that variable.
- 20 new integration tests have been written to test the
  `file.blockreplace` state.
2018-03-07 22:29:09 -06:00
Erik Johnson
1668a489c4
Update refrences to Oxygen codename to 2018.3.0 2018-02-21 21:47:41 -06:00
Erik Johnson
9d004f6512 Use mock 2.0.0 instead of unittest.mock on Python 3 (#2)
This preserves the custom mock_open we backported from unittest.mock,
but otherwise ditches unittest.mock as it does not have
MagicMock.assert_called in Python releases before 3.6.

This allows us to maintain a uniform mock version across all platforms
and Python releases.
2018-02-13 20:16:03 +01:00
Erik Johnson
293bdf2517
Merge pull request #45726 from rallytime/merge-oxygen
[oxygen] Merge forward from 2017.7 to oxygen
2018-01-28 13:05:00 -06:00
Nicole Thomas
2969d86237
Merge pull request #45735 from terminalmage/shellcase-debug-logging
Add debug logging to ShellCase functions
2018-01-28 08:27:20 -05:00
Erik Johnson
1cabf31a1f
Add debug logging to ShellCase functions
Some of these have been failing in ways which are not reproducible
locally. This adds debug logging so that we can check the
salt-runtests.log for the return data, to aid in troubleshooting.

NOTE: This also contains a fix for a bug in the CLI output handler that
I think may have a chance of fixing some of these odd failures.
2018-01-27 20:55:34 -06:00
Erik Johnson
f60183b95c
Use bytestrings for struct.pack/unpack
https://github.com/saltstack/salt/pull/45687 and
https://github.com/saltstack/salt/pull/45725 fixed problems with older
Python 2 versions interacting with the struct module, since
unicode_literals turned the format strings to unicode and older Python 2
releases can't accept a unicode format string. Since Python 2 and 3 both
support using bytestrings for the format strings, this commit makes sure
we are using bytestrings everywhere else we are using struct.pack/unpack.
2018-01-27 17:34:16 -06:00
rallytime
0ad101d560
Merge branch '2017.7' into 'oxygen'
Conflicts:
  - doc/man/salt.7
  - salt/modules/git.py
  - salt/modules/pacman.py
  - salt/states/git.py
  - tests/integration/modules/test_mac_user.py
  - tests/support/parser/__init__.py
2018-01-26 17:27:03 -05: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
6aa865cf54
Fix unnecessary/incorrect usage of six.binary_type 2018-01-22 11:17:06 -06:00
Nicole Thomas
12c0f99e8c
Merge pull request #45293 from terminalmage/py3-acl-auth-netapi
[PY3] Add unicode_literals to acl, auth, and netapi modules
2018-01-09 16:32:59 -05:00
Daniel Wallace
a8341fea01
clean up for windows tests for kitchen-salt 2018-01-06 17:14:46 -07:00
Daniel Wallace
e2824a7253
fix py3 tests 2018-01-05 13:36:08 -07:00
Erik Johnson
49dd5b32e9
[PY3] Add unicode_literals to acl, auth, and netapi modules 2018-01-05 10:31:11 -06:00
Erik Johnson
1dc6e79638
[PY3] Add unicode_literals to ext_pillar modules 2018-01-04 08:46:40 -06: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
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
rallytime
9ded5e1cbb
Merge branch '2017.7' into 'oxygen'
Conflicts:
  - salt/config/__init__.py
  - salt/grains/core.py
  - salt/modules/win_lgpo.py
  - salt/returners/mysql.py
  - salt/states/libcloud_dns.py
  - tests/integration/runners/test_runner_returns.py
  - tests/unit/grains/test_core.py
2017-12-21 15:58:08 -05:00
Daniel Wallace
d0586013eb
fix pylint 2017-12-21 10:40:54 -07:00
Daniel Wallace
59e2e56d13
chmod the xml files before trying to copy 2017-12-21 08:17:10 -07:00
Daniel Wallace
a5c1410e23
catch IOError when copying xml files back 2017-12-20 18:26:18 -07:00
Michael Calmer
744e698689
adapt tests to reflect reality
When CherryPy run with python3 it reads "bytes" from the wire.
In case of python2 BytesIO == StringIO, so nothing should change.

This change will do the same to make unit tests reflect reality.
2017-12-20 06:59:56 -05:00
Erik Johnson
7d6b679ac4
Fix fake importer for Python 3
Python 3 does not appear to pass all values to the `__import__` builtin
when they do not differ from the defaults. Therefore, the fake import
fails because of missing positional args.

This fix simply uses the defaults from Python 2 and 3's `__import__`
builtin.
2017-12-19 12:09:36 -06:00
Erik Johnson
15296e59a5
Add debug logging to SSHCase 2017-12-19 12:09:35 -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
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
Daniel Wallace
a7df9c3da3
fix py3 tests 2017-12-12 12:47:31 -07:00
rallytime
db5866d097
Update old utils paths to new utils paths 2017-12-11 18:43:33 -05: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
Erik Johnson
272044c688
Roll back use of explicit unicode literals 2017-12-10 17:41:45 -06: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
twangboy
f8110713f8
Use binary instead of unicode for loglevel 2017-12-06 21:31:43 -07: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
Ch3LL
61ac5cf157
Add spm -y and -f arg integration tests 2017-12-04 16:06:14 -05:00
Anthony Shaw
3611e08a27
import absolute paths 2017-11-29 10:00:41 +11:00
Anthony Shaw
a029f70cff
merge inbound, resolve conflict and remove unfinished state test module 2017-11-29 08:21:53 +11:00
Anthony Shaw
7b3ea6f5b9
mute false negative on linter 2017-11-25 19:03:23 +11:00
Anthony Shaw
0a34c12147
tests for napalm grains module, still issue to resolve on is_proxy 2017-11-25 05:47:27 +11:00
Anthony Shaw
38eb0dd000
more test fixtures 2017-11-24 17:14:14 +01:00