Commit graph

5225 commits

Author SHA1 Message Date
Brian Coca
4c8c40fd3d
fix unsafe preservation across newlines ()
* fix unsafe preservation across newlines

  CVE-2021-3583
  ensure we always have unsafe

Co-authored-by: Rick Elrod <rick@elrod.me>
2021-06-11 09:33:40 -04:00
Martin Krizek
5ac1b04929
Add support for unicode in ansible-inventory CLI ()
* Add support for unicode in ansible-inventory CLI

Fixes 

* Add tests

* First test fix

* --output tests

* fix
2021-06-11 05:07:55 +10:00
Sam Doran
0a5cc80ce2
slurp - handle error when path is a directory () 2021-06-10 10:25:48 +05:30
Sam Doran
004c33d9c5
unarchive - do not fail in init when trying to find required binary ()
Test for the required binaries in the can_handle_archive() method and fail there. This
prevents failures for missing binaries unrelated to the archive type.

* Update missing zip binary message to match tar message
* Update unit tests
* Add integration tests
* Define packages based on the system rather than ignoring failures
2021-06-07 12:59:06 -04:00
Matt Martz
ffa548503d
Wrap all results, regardless of register, except for actions with clean facts ()
* Wrap all results, regardless of register, except for actions with clean facts. Fixes 

* ci_complete

* Add tests

* Add clog frag
2021-06-04 16:40:53 +02:00
Hideki Saito
e70fc88656
slurp - better error handling for unreadable files and directories () 2021-06-04 10:38:23 -04:00
Martin Krizek
4f3ee4624e
Add end_batch meta task ()
* Add end_batch meta task

* Add note

* Fix sanity
2021-06-04 05:17:19 +10:00
Matt Martz
ac77911491
Prevent conditional templating errors from masking task output. Fixes () 2021-06-04 05:11:01 +10:00
Matt Martz
840825b79c
Allow omit to work with include_role from_args ()
* Allow omit to work with include_role from_args. Fixes 

* Add clog frag
2021-06-04 05:07:16 +10:00
Alicia Cozine
f88e81a62c
updates links in comments to point to current docs ()
Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com>
2021-06-03 14:00:24 -04:00
Brian Coca
9c718ccc42
Async status rewrite
-  remove need for module (at least for posix side)
  - adds retry with backoff on fetching file, since
    race is bigger since we don't spend time on module
  - now gives more info on fail
  - also made actionfail/skip handle results if given
2021-06-03 09:54:40 -04:00
Martin Krizek
e201b542be
Ensure end_play ends play, not batch ()
* Ensure end_play ends play, not batch

Fixes 

ci_complete

* Preserve result

* Move AnsibleEndPlay to TQM

* Add tests

* Add changelog

* Explaining comment

* Fix changelog name

* ci_complete
2021-06-03 09:26:22 +02:00
Martin Krizek
01ab6c6ec7
Apply display_failed_stderr on loop item results () 2021-06-01 11:31:46 -04:00
Abhijeet Kasurde
b0dcf0d164
collection: match skip message as per role install () 2021-06-01 09:44:01 +05:30
Rukmangathan
e0558ac193
yum action plugin: 'use' as an alias of 'use_backend' ()
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: rukmangathan <rukmangathan.annadurai@gigamon.com>
2021-05-31 09:48:15 +05:30
Sloane Hertel
5640093f1c
Use the module redirect_list when getting defaults for action plugins ()
* Fix module-specific defaults in the gather_facts, package, and service action plugins.

* Handle ansible.legacy actions better in get_action_args_with_defaults

* Add tests for each action plugin

* Changelog

Fixes 
2021-05-27 19:06:45 -04:00
Abhijeet Kasurde
ae50d05182
ini: Add parameter to allow no value ()
ConfigParser allows to read key with no value.

Fixes: 

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-05-27 11:12:38 +05:30
Abhijeet Kasurde
a61821b626
misc typos () 2021-05-26 19:28:52 +05:30
Matt Martz
d27ce4cef3
Remove deprecated features from ansible.playbook.helpers ()
* Remove deprecated features from ansible.playbook.helpers. Fixes 
2021-05-25 11:35:17 -04:00
Brian Coca
b518aabf81
delegation fix ()
*  delegation fix
2021-05-24 10:13:19 -04:00
Sam Doran
71e33d2578
version test - improve message when value is empty ()
When an empty value is provided, no `version` attribute will exist on the `LooseVersion` or
`StrictVersion` object. We catch and handle this, but it's not immediatebly clear that an
AttributeError means an empty value was provided.

Specifically handle the case where value or version are empty and add more
helpful error messages.

Add integration tests.
2021-05-20 11:55:30 -04:00
Brian Coca
d2d1f01f9d
avoid literal quoting in config lists ()
* added tests
2021-05-19 16:14:52 -04:00
Sam Doran
c0cb353ce1
Remove PyCrypto ()
* Remove PyCrypto from setup.py and packaging script
* Remove mention of pycrpto from installation docs
* Remove PyCrypto from vault
* Remove pycryto constraint and unit test requirement
* Remove PyCrypto tests from unit tests
* Add docs and fix warning message
* Remove section about cryptography library in Ansible Vault docs
2021-05-18 16:12:32 -04:00
Sam Doran
d8e6f21d9f
ini lookup - add case sensitive option ()
* Add tests for case-sensitive option
* Run all test playbooks from a single file
2021-05-17 11:41:23 -04:00
Sam Doran
8d3dce49bf Remove incidental_setup_rabbitmq integration test
All tests using this have been removed.
2021-05-14 12:31:18 -07:00
Sloane Hertel
bab7acb1ad
update cron test added in for /etc/crontab () 2021-05-13 16:58:46 -04:00
elara-leitstellentechnik
c6ac9de67b
Do not remove non-empty cron tabs ()
* Only remove crontabs if they are empty

* Add integration test to ensure system cron tab doesn't get removed. Increase cron integration tests separation.
* Also detect crontab which only contains whitespace as empty.
* cron integration test: Adjust system crontab path to be distribution specific.

Co-authored-by: Fabian Klemp <fabian.klemp@elara-gmbh.de>
2021-05-13 13:38:13 -04:00
Sam Doran
0affe4d027
ini lookup - catch and handle duplicate key and missing section errors ()
* Remove unused import
* Add integration tests for errors
* Cleanup formatting on existing tests
* Add changelog
2021-05-12 16:57:02 -04:00
Sam Doran
f99d024851
CI and compat fixes for Jinja2 >= 3.0 ()
* Add constraint for MarkupSafe

MarkupSafe >= 2.0.0 requires Python >= 3.6.0. Add a constraint for older Python versions
and fix the `groupby_filter` test.

* Fix template_jinja2_latest test.

* patch filter decorators on newer Jinja2

* Jinja2 >= 3.0 renames several filter decorators used by Ansible itself, as well as by filters in collections. This patch ensures that the old names are usable within Ansible and by collections without warnings or errors.

* Ignore docs-build issues.

Co-authored-by: Matt Clay <matt@mystile.com>
Co-authored-by: Matt Davis <mrd@redhat.com>
2021-05-11 19:59:44 -07:00
Matt Martz
8d1cf7f266
Vendor distutils.version ()
* Vendor distutils.version

* Fix import order. ci_complete

* remove distutils warning filter

* Don't remove warnings filter from importer

* ci_complete

* Add pylint config for preventing distutils.version

* Add changelog fragment
2021-05-11 12:33:51 -05:00
Sloane Hertel
cf11c38caf
Exclude unreachable hosts in ansible_play_batch between plays ()
ci_complete
2021-05-11 17:12:34 +02:00
David Shrewsbury
8fb54885bf
Role argspec: allow new argument spec file ()
* support separate role argspec file in ansible-doc

* support separate role argspec file in ansible-core

* support both .yml and .yaml extensions on argspec file in ansible-doc

* fix filename building bug and rename some argspec files to test variations

* use yaml extensions from constants

* add superfluous meta/main.yml files to tests

* Update lib/ansible/cli/doc.py

Co-authored-by: Sam Doran <sdoran@redhat.com>

* update docs

* ci_complete

* add changelog and allow for main.yml variations

* add collection role testing

Co-authored-by: Sam Doran <sdoran@redhat.com>
2021-05-11 09:29:47 -05:00
Matt Clay
d244e47822
Update Python versions for controller-only tests. ()
* Update Python versions for controller-only tests.

Both `ansible-galaxy` and `ansible-test` integration tests only run on the controller.

* Use a venv to make requirements available.
2021-05-10 18:25:53 -07:00
Ruediger Pluem
2f7e0b8489
user - consistently create user home directory on Linux ()
Always use create_homedir when we are asked to create a home directory
in the User class. Don't use the -m and -k parameters from
useradd / luseradd as they behave differently with respect to
preexisting home directories. Instead always specify -M to ensure
that useradd / luseradd do not try to create the home directory.

This does not change potential different behaviours in child classes
of the User class.

Consider the new umask option from  in create_homedir as well as
we do not let luseradd / useradd create the home directory any longer.
2021-05-07 17:00:10 -04:00
René Moser
403a5d147d
modules: get_url: Fix checksum binary validation ()
From the sha512sum man page:

... The default mode is to print a line with checksum, a character indicating type ('*' for binary, ' ' for text), and name for each FILE.
2021-05-07 10:29:22 -04:00
Brian Coca
35ff4ea95b
warn on walking through pathing issues ()
* warn show pathing issues when wallking through provided paths

  moved issues from msg to actual warnings AND a specific return field

  fixes 

Co-authored-by: Sam Doran <sdoran@redhat.com>
2021-05-06 16:14:33 -04:00
Abhijeet Kasurde
38dd49eb00
ansible-inventory: Handle exception in toml parsing ()
Handle stacktrace raise while parsing inventory in toml format

Fixes: 

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-05-05 14:12:52 +05:30
David Shrewsbury
c6fda9fc1a
[coverage] improve test coverage for together lookup () 2021-05-04 11:41:22 -04:00
David Shrewsbury
4f0a9488bb
[coverage] improve test coverage for indexed_items lookup () 2021-05-04 11:41:02 -04:00
David Shrewsbury
244bf9c640
[coverage] improve test coverage for vars lookup () 2021-05-04 11:39:04 -04:00
Brian Coca
30912b6a47
dont specify default for port, allow ssh/config ()
* dont specify default for port, allow ssh/config

 also added general note on how defaults work.

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Sam Doran <sdoran@redhat.com>
2021-05-04 11:09:05 -04:00
Sam Doran
728e43bc59 callback_default test - Reduce sleep time to correct CI failures
For unknown reasons, these tests started failing recently because the results
from testhost11 are being returned before testhost10, but only when coverage is
enabled.

Setting the initial host sleep time to 0 fixes this failure.

ci_coverage
2021-05-03 17:55:10 -07:00
Matt Clay
ca507ff477 Integration test fixes. 2021-04-30 17:59:28 -07:00
Rick Elrod
d8c20a73a4
[ansible-test] Add Fedora 34, update Fedora 33 ()
Change:
- Added Fedora 34 container image to docker.txt
- Dropped Fedora 32 from CI
- Added Fedora 34 to CI
- Updated Fedora 32 and 33 containers for ssh-related fixes
- Move cron fix from 698eae3f3d into
  cron_setup and make it more generic; it can affect modern distros too.

Test Plan:
- ci_complete

Signed-off-by: Rick Elrod <rick@elrod.me>
2021-04-30 11:35:12 -05:00
Maxim Masiutin
6ea81b84ed
apt_key - correct error message about the failure to import a 'gpg' () 2021-04-30 12:06:38 -04:00
Maxim Masiutin
d147c1ef1f
apt_key test - Change the URL of the GPG key to S3 and remove it from the repo () 2021-04-30 10:44:50 -04:00
Abhijeet Kasurde
1a7923e318
pip: Idempotency tests ()
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: David Moreau Simard <dmsimard@redhat.com>
2021-04-29 15:14:18 -04:00
David Shrewsbury
f1a5c411d9
Fix sequence lookup message and add tests ()
* add test for bad kv arg value
* add simple form parsing tests and make error messages the same
* add changelog
2021-04-29 15:12:23 -04:00
Maxim Masiutin
3bc2e7783c
Binary GnuPG keys downloaded via URLs by the 'ansible.builtin.apt_key' module were corrupted so 'gpg' could not import them (https://github.com/ansible/ansible/issues/74424) () 2021-04-28 10:41:14 -04:00
Sam Doran
62cba4a6ad incidental_setup_rabbitmq test - Use official repo for rabbitmq-erlang
Previously it was hosted on bintray, but that service is shutting down on May 1. Using the new
repository also required using a newer version of RabbitMQ.
2021-04-27 10:02:27 -07:00