Commit graph

6122 commits

Author SHA1 Message Date
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
Alexandre Garnier
8698855ffd
Case-insensitive set theory filters ()
Fixes 

* Fix call to 'unique(case_sensitive=False)' triggering error when falling back to Ansible's version which **is** case-sensitive
* Test multiple situations of 'unique' filter errors with fallback not handling specific parameters

Signed-off-by: Rick Elrod <rick@elrod.me>
Co-authored-by: Rick Elrod <rick@elrod.me>
2021-04-23 12:44:43 -05:00
Matt Clay
6cfe36fa1f
Set ansible-test min controller Python to 3.8. ()
- Version neutral sanity tests now require Python 3.8 or later.
- Unit tests for controller-only code now require Python 3.8 or later.
2021-04-23 00:26:19 -07:00
Alexander Sowitzki
ff88a2a06d Fix combinated run of unarchive and uri tests under centos 6
The unarchive integration test installs pinned packages via pip,
the uri test installs them from system packages. This explodes.
PR lets unarchive uninstall packages after test ran.
2021-04-22 17:09:10 -07:00
Matt Martz
bf7d4ce260
Abstract away libyaml details into yaml utils ()
* Add yaml utils file and use it

* Linting fix and missing import

* Abstract a few more details

* Parser imports

* Don't use CSafeDumper in AnsibleDumper

* Move and use convert_yaml_objects_to_native when libyaml is present

* yaml_load and yaml_dump, instead of safe_*

* re-use HAS_LIBYAML from utils.yaml

* add changelog fragment

* Address recent changes

* Use representer instead of recursive type converter

* Restore needed import

* move yaml utils to module_utils

* Properly guard imports

* Update from_yaml(_all)? to handle text wrappers with CSafeLoader

* Use yaml utils for legacy_collection_loader

* Add HAS_YAML, and ignore pylint issue

* oops

* GPL->BSD
2021-04-21 16:47:03 -05:00
Brian Coca
6418f368e3
Fix pb subs collapse ()
* fix subdir parsing for plays

  fixes 

  Co-authored-by: Nikolaos Kakouros <nkak@kth.se>
2021-04-21 17:27:41 -04:00
Matt Martz
a3e7cf0110
Update alpine repo to community for libuser () 2021-04-21 16:20:50 -05:00
Rick Elrod
738132da95
[ansible-test] add freebsd/13.0 remote ()
Change:
- FreeBSD 13.0 was released on the 13th, add it to ansible-test.

Test Plan:
- ci_complete

Signed-off-by: Rick Elrod <rick@elrod.me>
2021-04-21 15:13:41 -05:00
elara-leitstellentechnik
437a08eb6d
Map Debian 8 to Python 2 ()
* Map Debian 8 to Python 2

If Python 3 is installed on Debian 8 Ansible cannot run, as the version
is too old (3.4)

* Add integration test for python interpreter discovery on Debian 8

* fix test issue on Debian 9, add changelog

* un"fix" not broken test :D

Co-authored-by: Fabian Klemp <fabian.klemp@elara-gmbh.de>
Co-authored-by: Matt Davis <mrd@redhat.com>
2021-04-20 15:28:24 -07:00
Amin Vakil
49d4442378
Add umask option to user module ()
* Add umask option to user module

* Fail on setting both umask and local: True

* Add integration test

* Add changelog

* Run integration tests only if HOME_MODE is not set

* Run integration tests only on Linux

Co-authored-by: Matt Clay <matt@mystile.com>
2021-04-20 12:01:56 -04:00
David Shrewsbury
d44eb03f49
Remove include from tests () 2021-04-20 11:19:29 -04:00
Rick Elrod
698eae3f3d [tests] Work around vixie-cron and PAM issue, el6
Change:
- This works around an issue that causes the cron test to fail sometimes
  on el6.

Test Plan:
- ansible-test integration cron --docker centos6

Signed-off-by: Rick Elrod <rick@elrod.me>
2021-04-19 20:41:30 -07:00
Matt Martz
17237c1d88
Deprecate Py2.6 support for target nodes () 2021-04-16 11:42:29 -05:00
Amin Vakil
a7c8093ce4
[2.12] Add accept_newhostkey option to git module ()
* Add integration test for accept_newhostkey option

* Add changelog
2021-04-16 11:10:35 -04:00
Jordan Borean
019452dda7
uri - fix traceback on multipart-form int value () 2021-04-16 11:09:31 -04:00
Amin Vakil
fdee5ca16d
Add cacheonly option to yum and dnf modules ()
* Add integration test

* Add changelog

Co-authored-by: Matt Clay <matt@mystile.com>
2021-04-16 11:08:52 -04:00
Martin Krizek
7fecb7ccc3
Actually run blocks/finalized_task test () 2021-04-16 08:04:11 +02:00
Rick Elrod
7ef3dc2b8b
[controller ansiballz] escape directory regex ()
Change:
- We were passing a directory name directly to re.compile().
  If the directory isn't valid regex (or is) this can have odd side
  effects, such as crashing.
- Fix a few other similar cases, but less likely to be a real issue.

Test Plan:
- New test

Signed-off-by: Rick Elrod <rick@elrod.me>
2021-04-15 17:06:58 -05:00
Matt Martz
1082e2ab79
Catch errors getting filters ()
* Catch errors getting filters, and fail

* Add changelog

* Switch to warnings instead of errors, to match other plugin loader behavior

* Add tests

* Handle collections
2021-04-15 15:51:41 -05:00
Martin Krizek
664531d7d6
Prevent ansible_failed_task from further templating ()
* Prevent ansible_failed_task from further templating

Fixes 

* Add changelog
2021-04-16 05:48:57 +10:00