Commit graph

39764 commits

Author SHA1 Message Date
Matt Clay
54d06d042e Fix integration test library search path.
This prevents tests from loading modules outside the source tree,
which could result in testing the wrong module if a system-wide
install is present, or custom modules exist.

(cherry picked from commit d603cd41fe)
2018-10-09 18:25:24 -07:00
Matt Clay
76d71f034e Bug fixes and cleanup for ansible-test. (#45991)
* Remove unused imports.
* Clean up ConfigParser usage in ansible-test.
* Fix bare except statements in ansible-test.
* Miscellaneous cleanup from PyCharm inspections.
* Enable pylint no-self-use for ansible-test.
* Remove obsolete pylint ignores for Python 3.7.
* Fix shellcheck issuers under newer shellcheck.
* Use newer path for ansible-test.
* Fix issues in code-smell tests.

(cherry picked from commit ac492476e5)
2018-10-09 18:25:24 -07:00
Matt Clay
b0b23d5a91 Add python.py coverage injector for ansible-test.
This can be used to run Python scripts from the repository with the
correct interpreter and allow collection of code coverage.

Useful for testing contrib inventory scripts.

(cherry picked from commit 45b5685037)
2018-10-09 18:25:24 -07:00
Matt Clay
f35f7e2e54 Improve error handling for docs-build test.
(cherry picked from commit 2148999048)
2018-10-09 18:25:24 -07:00
Matt Clay
4389e2175a Improve ansible-test match error handling.
(cherry picked from commit 2056c981ae)
2018-10-09 18:25:24 -07:00
Dag Wieers
0aa2aaa175 Fix incorrect use of subprocess.CalledProcessError (#45890)
(cherry picked from commit 24dd87bd0a)
2018-10-09 18:25:24 -07:00
Matt Clay
cfe86582f2 Support comments in ansible-test flat files.
(cherry picked from commit 5a3000af19)
2018-10-09 18:25:24 -07:00
Matt Clay
7842b99106 Make ansible-test available in the bin directory. (#45876)
(cherry picked from commit f3d1f9544b)
2018-10-09 18:25:24 -07:00
Matt Clay
434d9b2f2a Block network access for unit tests in docker.
(cherry picked from commit 99cac99cbc)
2018-10-09 18:25:24 -07:00
Matt Clay
5d19738af6 Minor fixes for unit test delegation.
(cherry picked from commit be199cfe90)
2018-10-09 18:25:24 -07:00
Matt Clay
86f37620e6 Run unit tests in parallel. (#45812)
(cherry picked from commit abe8e4c9e8)
2018-10-09 18:25:24 -07:00
Matt Clay
ecc706f122 Fix ansible-test unit test execution. (#45772)
* Fix ansible-test units requirements install.
* Run unit tests as unprivileged user under Docker.

(cherry picked from commit 379a7f4f5a)
2018-10-09 18:25:24 -07:00
Matt Clay
6d07cec588 Fix unit test parametrize order on Python 3.5.
(cherry picked from commit 53b230ca74)
2018-10-09 18:25:24 -07:00
Matt Clay
09e61f29e9 Fix unit tests which modify the source tree. (#45763)
* Fix CNOS unit test log usage.
* Use temp dir for Galaxy unit tests.
* Write to temp files in interfaces_file unit test.
* Fix log placement in netapp_e_ldap unit test.

(cherry picked from commit 0686450cae)
2018-10-09 18:25:24 -07:00
Nathaniel Case
e575f655c1 Clean up after cnos tests (#45564)
(cherry picked from commit 0b433b3ea9)
(cherry picked from commit 71b3951d09aed385be0771d01ba739348451e720)
2018-10-09 18:25:24 -07:00
Vlad Mencl
83194a0a99 module/systemd: fix logic determining if a service needs to be enable… (#46318)
* module/systemd: fix logic determining if a service needs to be enabled (#46245)

* modules/systemd: fix logic: allow scope to default to 'system'

Fix logic introduced in 7ea909418e: if 'scope' param is not specified,
it defaults to system, but the value of module.params['scope'] is None,
not 'system' - so allow for that.

* modules/systemd: fix logic: disabled means disabled

Fix logic determining whether a service with both systemd and initd files is enabled or disabled.

In situations where systemd thinks service is disabled, but rc.d symlinks mark it as enabled,
this module wrongly assumes the service is enabled.

Fix this logic: disabled means disabled

Only when the output from does NOT include disabled, consider the status of rc.d symlinks.

This essentially replicates the fixes done to the systemd handling in the "service" module in 3c89a21e0c

Fixes #22303

Fixes #44409

(cherry picked from commit ef131c7556)

* backport/2.7/46245: add changelog fragment
2018-10-09 18:23:47 -07:00
Daniel Jakots
26de4f9749 Add support for OpenBSD (#46147)
(cherry picked from commit 2769a4e2cc)
2018-10-09 18:22:44 -07:00
René Moser
083d2a6ad7 [2.7] backport cs_instance fixes (#46274)
* cs_instance: doc: fix typo in examples (#46035)


(cherry picked from commit c09b785a66)

* cs_instance: fix host migration without volume (#46115)


(cherry picked from commit e7926cf9f4)

* add changelog fragment
2018-10-09 18:22:07 -07:00
Felix Fontein
c481a5bf4a [2.7] route53: fix CAA record ordering for idempotency (#46227)
* [aws] route53 module: fix idempotency for CAA records  (#46049)

* Fixing record order for CAA records to properly handle idempotency.

* Add integration tests that reproduce CAA failure

(cherry picked from commit a727a1ee67)

* Added changelog.
2018-10-09 18:21:25 -07:00
Felix Fontein
85e227d338 Remove regression test for fix which is in another backport PR (#45769). 2018-10-09 18:20:13 -07:00
Felix Fontein
1d01543e34 docker_container: fix various idempotency problems and non-working options (#45905)
* Sorting args.

* Doing comparisons of options with container parameters in a more context-sensitive way.

This prevents unnecessary restarts, or missing restarts (f.ex. if parameters are removed from ``cmd``).

* Make blkio_weight work.

* Fix cap_drop idempotency problem.

* Making groups idempotent if it contains integers.

* Make cpuset_mems work.

* Make dns_opts work.

* Fixing log_opts: docker expects string values, returns error for integer.

* Adding tests from felixfontein/ansible-docker_container-test#2.

* Make uts work.

* Adding changelog entry.

* Forgot option security_opts.

* Fixing typo.

* Explain strict set(dict) comparison a bit more.

* Improving idempotency tests.

* Making dns_servers a list, since the ordering is relevant.

* Making dns_search_domains a list, since the ordering is relevant.

* Improving dns_search_domains/dns_servers.

* Fixing entrypoint test.

* Making sure options are only supported for correct docker-py versions.
2018-10-09 18:20:13 -07:00
Felix Fontein
18b575b593 integration tests for docker_container (#45747)
* First round of integration tests for docker_container.

* Added regression test for #45700.

* Work around dict order randomization.
2018-10-09 18:20:13 -07:00
Nathaniel Case
b1b93c7a22 [2.7] Clean up after ansible-connection if failure occurred in start() (#45930)
* [2.7] Clean up after ansible-connection if failure occurred in start() (#45929)
(cherry picked from commit 0d143ed)

Co-authored-by: Nathaniel Case <this.is@nathanielca.se>

* Add changelog fragment
2018-10-09 18:18:32 -07:00
Matt Martz
cf28d22211 [stable-2.7] Support transfering empty files to target host. Fixes #36725 (#45751)
(cherry picked from commit b6fcbfe)

Co-authored-by: Matt Martz <matt@sivel.net>
2018-10-09 18:18:06 -07:00
Pieter Avonts
190cdd3a29 VMware: Rewrite get_resource_pool method for correct resource_pool selection (#39792)
* rewrite get_resource_pool method for correct resource_pool selection
* only keep name if path is given for cluster, esxi_hostname or resource_pool
* Revert "only keep name if path is given for cluster, esxi_hostname or resource_pool"
* This reverts commit 50293ec763c024b0eaceac5d775ccc0ad3ff8bd7.
* if the name argument contains a path, only use the last part for matching
* remove path from cluster argument in tests
* remove find_objs in favour of reusing find_obj with an extra folder argument
* fix find_obj ignoring first if name is not given

(cherry picked from commit 1a810f8f11)
2018-10-09 13:47:43 -07:00
Felix Fontein
ccde3dc66b docker_container: fix behavior when image is not specified (#46322)
* Don't simply ignore container in present() if image is not specified.

* Use image from existing container for recreation if not specified.

* Added changelog.

* Improve comment.

(cherry picked from commit 895019c59b)
2018-10-09 13:47:13 -07:00
Tobias Wolf
ee523beb8e [rabbitmq_binding] Fix the quoting of vhost and other names (#45109)
* [rabbitmq_binding] Fix the quoting of vhost and other names, which was broken in PR #35651
* Merge missing urllib_parse.quote from PR #42422
* Missed one line, where  also needs to be escaped, i.e., the destination

(cherry picked from commit d5f8738bf2)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-10-09 13:46:20 -07:00
Jordan Borean
93b75558bb azure_rm_common: use __version__ from module_util (#46184)
(cherry picked from commit 02c11e6b51)
2018-10-09 13:42:47 -07:00
Jordan Borean
10038a423b ps-lint: ignore rules that are not relevant to Ansible (#46376)
(cherry picked from commit ba638f40cf)
2018-10-09 13:40:36 -07:00
Sam Doran
19fe83d786 Use proper index value with insertbefore on a one line file (#46071)
Add tests and changelog

(cherry picked from commit b74279d14c)
2018-10-09 12:17:30 -07:00
Yann Rouillard
ac56230d5b Only delete key from redis in-memory cache if present (#35126)
Fixes #35120 : the redis cache plugin keeps key/value
entries in an in-memory cache to avoid hitting the
redis database each time.

The problem is that a cache entry is only set when
a value is get or set but it is always deleted when
trying to delete a value.

When the --flush-cache ansible-playbook option is used,
the redis cache plugin is first asked to remove every
entry corresponding to every hostname present in the inventory.
As no value as been set/get so far, it then tries to delete
an unexisting value from the cache and hence crashes with
a KeyError exception.

(cherry picked from commit ee3dfef016)
2018-10-09 12:09:07 -07:00
Ganesh Nalawade
b6276fe4a4 Make default_operation optional in netconf_config module (#46333)
Fixes #46257

*  As per netconf rfc default-operation value is optional,
   hence removing the default value for default_operation
   option.

(cherry picked from commit 5e6eb921ae)

* Update changelog
2018-10-09 12:01:33 -07:00
Matt Clay
b6810eb37c Use default Shippable container. (#46703)
(cherry picked from commit 40c9301b27)
2018-10-09 11:46:46 -07:00
Johannes Brunswicker
2703be8368 Backport/2.7/42456 - Added SSL Support to consul_kv lookup plugin (#46466)
* Add ssl support to consul_kv lookup (#42456)

* implemented lookup_consul_kv
* added missing version_added for consul_url ini section
* added default value for ANSIBLE_CONSUL_CLIENT_CERT and added some more documentation
* removed trailing whitespaces
* fixed indention
* Fixes in Documentation
* removed trailing whitespace
* removed trailing whitespace

(cherry picked from commit bacbd4e9fc)

* * added changelog fragment
2018-10-09 11:25:31 -07:00
Jordan Borean
2388126bdf win_chocolatey: remove test packages after tests are run (#46431)
(cherry picked from commit 1de88cbaa9)
2018-10-09 11:18:38 -07:00
cadl42
3cfbc2791f Ignore empty result of rabbitmqctl list_user_permissions (#35598)
Fix #34863

(cherry picked from commit a7221dd289)
2018-10-09 11:17:37 -07:00
Kévin Subileau
f5bc8457e4 win_nssm: add changelog fragment 2018-10-09 11:13:37 -07:00
Kévin Subileau
6a27a4251e win_nssm: wrong variable in tests
(cherry picked from commit 9b9c839461bc428e0ab3897b7681492a45728f73)
2018-10-09 11:13:37 -07:00
Kévin Subileau
7601f1c153 win_nssm: restore support of string as dict form for app_parameters and remove support of literal YAML dict
(cherry picked from commit 862855252b5f8ff9cdd6ef8a4b3e6afee6a3c326)
2018-10-09 11:13:37 -07:00
Kévin Subileau
2de895a07b win_nssm: restore comma as separator for service dependencies
Revert commit ddd4b4b

(cherry picked from commit ead882bb9b0bb9e576eda9e074f9150785f9512f)
2018-10-09 11:13:37 -07:00
Kévin Subileau
4215feeb5e win_nssm: test parameters with spaces, quotes or backslashes
(cherry picked from commit 51843a7b3c7120721d19b192408d7a5984b12d67)
2018-10-09 11:13:37 -07:00
Kévin Subileau
80c0693116 win_nssm: fix several idempotence issues and misbehaviors
Add missing space between arguments when app_parameters contains several keys.
Use Argv-ToString and Escape-Argument to improve arguments handling (parameters with quotes, backslashes or spaces).

(cherry picked from commit 933a4092bf584108849b5161bbdd00092c4c8c09)
2018-10-09 11:13:37 -07:00
Kévin Subileau
da801283ee win_nssm: add idempotence tests
(cherry picked from commit 46a5e4f3bfbeecb34693d0a8597e5d9643a03624)
2018-10-09 11:13:37 -07:00
Kévin Subileau
5eef5f629e win_nssm: fix error with app_parameters parameter
Fix #25265

(cherry picked from commit aba0d48ba5fe74842ceb3584753e4fc9bca1bc92)
2018-10-09 11:13:37 -07:00
Kévin Subileau
df1aaab3df win_nssm: fix incorrect separator in doc for service dependencies
The dependencies parameter works with space as separator, but not with comma as shown in the documentation

(cherry picked from commit ddd4b4bea69a39e8e2aadac9d23c1f64bd1355f5)
2018-10-09 11:13:37 -07:00
Kévin Subileau
6ea0fccfe2 win_nssm: fix service not started when state=started
Nssm status returns a multiline output that doesn't match any of the strict patterns in the switch statement.

(cherry picked from commit 8180a7c39b2936426e6def0fa06edd974845d36b)
2018-10-09 11:13:37 -07:00
Kévin Subileau
2409ae5f27 win_nssm: add more failing tests
These tests highlight several issues with this module:
 * Service not started when state=started
 * Errors with app_parameters (see #25265)
 * Exception when passing several dependencies separated by comma as specified in doc

(cherry picked from commit e50234bdb32304703fd1ce1d4f6067a0d551049e)
2018-10-09 11:13:37 -07:00
Kévin Subileau
f81229c85c win_nssm: use Run-Command instead of Invoke-Expression to prevent interpretation issue
Fix #44079

(cherry picked from commit 20a0d90ebeec92fc498e29d57393b280f6e639a5)
2018-10-09 11:13:37 -07:00
Kévin Subileau
14cccb9488 win_nssm: add failing tests for issue #44079
(cherry picked from commit a5d1241fa13b308813173e7686277e15c09c0bdb)
2018-10-09 11:13:37 -07:00
Sam Doran
8b0c46a51a Use bytes rather than native string for result (#46281)
This prevents a stack trace in Python 3 when the result is an empty file since
the file is open in binary mode and a native string in Python 3 is str,
not bytes.

(cherry picked from commit 8b1ae30e2e)
2018-10-09 11:08:11 -07:00