Commit Graph

11938 Commits (016b7f71b10539c90ddbb3246f19f9cbf0e65428)

Author SHA1 Message Date
Martin Krizek e1daaae42a
Fix using FQCN for flush_handlers (#79057)
Fixes #79023
2 years ago
Brian Coca ff6e4da36a
fixes to FA inheritance (#78990)
finalized applies to all field attributes
fix getting parent value
also remove unused/needed extend/prepend signature
moar testing
2 years ago
Felix Fontein 6d0aeac1e1
Do not crash templating when filter/test name is not a valid Ansible plugin name (#78913)
* Do not crash templating when filter/test name is not a valid Ansible plugin name.
* Store and re-raise KeyError if there was one.

Co-authored-by: s-hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Matt Clay 5b239acb77 ansible-test - Update distro containers to 4.8.0.
The updated containers include coverage 6.5.0.
2 years ago
Brian Coca 9650ddb11c
omit keyword should reset to context (#78917)
* omit keyword should reset to context

  ensure we use context/inheritance when calculating value,
  using default only when context is unavailable.

  fixes #75692
2 years ago
Matt Clay 20c1252212 ansible-test - Update coverage to version 6.5.0.
ci_complete
ci_coverage
2 years ago
Jordan Borean ba6da65a0f
Fix connection/become task loop settings (#78565)
* Fix connection/become task loop settings

* Remove old code
2 years ago
Jordan Borean be4807b712
ansible-test validate-module - support sidecar docs (#78904) 2 years ago
Matt Martz c3fc8db41c
Deprecate using a list of dicts for vars. See #78920 (#78927) 2 years ago
Felix Fontein d93883645c
Upgrade antsibull-docs to 1.6.1 (#78872)
* Bump antsibull-docs version to 1.6.0 to fully support filter docs.

* known_good_reqs.txt no longer exists.

* Bump version to 1.6.1.
2 years ago
Brian Coca 0b678d5036
avoid roles exporting vars: (#69040)
- correct 'vars:' precedence to allow phasing out of include_params
 - actually merge vars and always include role_vars
 - avoided dupe deps from giving wrong vars
 - use 'first' instance of dep as others are from previous instances/invocations
   and can have diff values for vars
 - ensured deps only provide exportable vars themselves
 - added COMMENTS
 - added tests
 - apply export restrictions setting to defaults
 - use 'public' as cutoff

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>

ci_complete
2 years ago
Matt Clay bc274f57f7
ansible-test - Improve pylint command consistency. (#78896)
* ansible-test - Improve pylint command consistency.

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2 years ago
sbettid de4ff281ab
Fix known_hosts changed status when removing non-existing key (#78748)
* Ensure no change is reported when removing missing key for host with other keys

Co-authored-by: Matt Martz <matt@sivel.net>
2 years ago
Felix Fontein 50dae8087e
runtime-metadata sanity test: ensure redirects are FQCRs (#78802)
* Ensure that meta/runtime.yml redirects are FQCRs.

* Avoid crash when YAML errors without context mark happen, for example if file starts with 'foo---' instead of '---'.
2 years ago
Matt Clay d3d7785472
ansible-test - Fix integration test target filter. (#78862)
- Allow disabled, unsupported, unstable and destructive integration test targets to be selected using their respective prefixes.
- Allow unstable tests to run when targeted changes are made and the ``--allow-unstable-changed`` option is specified (resolves https://github.com/ansible/ansible/issues/74213).
2 years ago
Matt Clay 16cde1104f
ansible-test - Update base and default containers. (#78846) 2 years ago
Matt Martz 4c26022171
Don't request repo updates when only testing modes (#78843) (#78850)
(cherry picked from commit 254204856f)
2 years ago
Matt Martz 76b746655a
Add `use_rsa_sha2_algorithms` option for paramiko (#78789)
Fixes #76737
Fixes #77673

Co-authored-by: Matt Clay <matt@mystile.com>
2 years ago
Matt Clay 4d25233ece
ansible-test - Update Python 3.11 support. (#78840)
- Update sanity test requirements to fully support Python 3.11.
- Make Python 3.11 the default in the base and default test containers.
2 years ago
Alex Willmer 163819efa2
tests: Fix `test_ansible_version()` when run within a git checkout (#78636)
When running the unit tests locally, in a git clone, `ansible --test`
prints additional information about the git revision, e.g.

```
~/src/ansible$ ansible --version
ansible 2.10.8
...
~/src/ansible$ source hacking/env-setup
...

Setting up Ansible to run out of checkout...
...
~/src/ansible$ ansible --version
[WARNING]: You are running the development version of Ansible. You
should only run Ansible from "devel" if you are modifying the Ansible
engine, or trying out features under development. This is a rapidly
changing source of code and can become unstable at any point.
ansible [core 2.14.0.dev0] (test_ansible_version-devel df497ea13b) last
updated 2022/08/25 10:37:07 (GMT +100)
...
```

which causes `test_ansible_version()` to fail.

Also removed an unused argument from previous parameterisation.

Co-authored-by: Alex Willmer <alex.willmer@cgi.com>
2 years ago
Brian Coca b1ff0f4ebc
vault secrets file, keep context when symlink (#78734)
* vault secrets file, keep context when symlink

	fixes #18319

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Matt Clay e5e87a3927
ansible-test - Update pylint to 2.15.3. (#78811) 2 years ago
Sloane Hertel a02e22e902
Add --offline option to 'ansible-galaxy collection install' (#78678)
* Add --offline option to 'ansible-galaxy collection install' to prevent querying distribution servers

This allows installing/upgrading individual tarfiles to have dependency resolution.
Previously needed to be done manually with --no-deps or else all collections and dependencies needed to be included in the requirements.

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2 years ago
Ruediger Pluem 1d410ca700
Fix local facts unreadable (#76095)
* Catch exceptions during stat calls

If such an exception is not caught it causes the complete
local facts gathering to fail.
2 years ago
Markus Opolka 616ad883ad
Add OSMC to Debian OS_FAMILY_MAP (#78778)
* Add OSMC to Debian OS_FAMILY_MAP

 - os_family fact of the Debian-based OSMC distribution was not detected correctly

* tweak changelog

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
2 years ago
Sloane Hertel f26f3325ba
apt - fix module short-circuiting when a package is not installed and only_upgrade is True (#78790) 2 years ago
Matt Clay 7683c0ae54
ansible-test - Update base and default containers. (#78774) 2 years ago
Sloane Hertel 4b45b4b09d
apt - fix failure when package is not installed and only_upgrade=True (#78781)
* apt - fix module failure when package is not installed and only_upgrade is True

* changelog
2 years ago
Sloane Hertel 86b86398f0
add ansible_name/ansible_aliases attrs to plugin objects (#78700)
*  new _fqcn attribute to plugin objects
* unbreak plugins in subdirs
* Fix inadventent changes to _load_name and use existing vars
* add plugin aliases and name property, and replace plugin._load_name where incorrect
* Fix listing plugin names

Fix listing legacy and builtin together
test deprecated plugin documentation
fix doc extensions
remove sometimes inaccurate _load_name handling from plugin.name

* Add tests for REJECT_EXTS and doc extensions

Fix unpredictable collection redirects so non-fqcns in the redirect list are guaranteed to be legacy (instead of determined by the collections keyword)

Move aliases and name properties to _update_object so all plugin types, including doc fragments, can use them

* make legacy plugin names internally consistent
* rename attributes to ansible_name and ansible_aliases
2 years ago
Matt Clay 4c720036e4
Update docs-build and rstcheck sanity tests. (#78773) 2 years ago
Sloane Hertel 563f3ecc11
Error for context-dependent redirects (#78755) 2 years ago
David Moreau Simard 86ab63f281
Recover unix load average into an ansible_loadavg fact (#75319)
* Recover unix load average into an ansible_loadavg fact

The average load is available out of the box with os.getloadavg().
It adds useful context to the existing ansible_memory_mb and ansible_mounts
facts that provide size and utilization or memory and disk space.

* Add an integration test
2 years ago
Martin Krizek a6d4c3ff7c
Print skip reason for skipped meta tasks instead of an empty msg in -vv (#78681)
Fixes #77315
2 years ago
Artur a26c325bd8
uri: added use_netrc argument to allow ignoring netrc (#74397) (#78569) 2 years ago
Matt Clay 79f67ed561
ansible-test - Fix container error handling. (#78739) 2 years ago
Matt Clay 2e5e8026cc
Improve split integration test. (#78738)
* Omit redundant fact gathering.

* Add connection type to split test.

* Add user info to split integration test.
2 years ago
Matt Clay 62221a3be2
Update test matrix symlinks. (#78737)
* Add remote platform symlinks.

These were already supported by ansible-test.
This change adds the symlinks for use in the CI test matrix.

* Remove obsolete AIX test symlink.

AIX was already removed from ansible-test.
2 years ago
Matt Martz b8025ac160
Allow selection of TLS/SSL ciphers (#78650)
* Allow selection of TLS/SSL ciphers. Fixes #78633
* Never pass None as the password. Fixes #53373
2 years ago
Felix Fontein fa093d8adf
ansible-doc: remove manual formatting (#78668)
* remove manual formatting and make the output align closer with the original YAML

Co-authored-by: Brian Coca <brian.coca+git@gmail.com>
2 years ago
Matt Clay 8a7b89c2f4
ansible-test - Update distro containers. (#78729) 2 years ago
Matt Clay b3854161a0
ansible-test - Update coverage to version 6.4.4. (#78728) 2 years ago
Matt Clay c56b35598f
ansible-test - Upgrade pylint. (#78727)
This version of pylint now supports Python 3.11.
2 years ago
Johanan Liebermann fbd828673d
Fix distro fact handling for Flatcar (#77635)
* Fix distro fact handling for Flatcar

The existence of the file /etc/flatcar/update.conf depends on
bootstrap configuration typically provided by the user. For that
reason this file is unsuitable for determining distro facts for
Flatcar Container Linux.

The distribution_release fact is meaningless in the case of Flatcar
since Flatcar doesn't have named releases. The distribution_version
fact, however, IS meaningful and should contain a number such as
"3139.2.0".

- Use /etc/os-release instead of /etc/flatcar/update.conf.
- Drop the distribution_release fact.
- Set the distribution_version fact.
- Update distro test fixture for Flatcar
- Generate the fixture using gen_distribution_version_testcase.py.
- Override result.distribution and result.os_family manually as the
  generator script gives wrong values.
- Use a recent Flatcar version.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
2 years ago
Sloane Hertel 41b62f7db4
Limit Galaxy API calls during ansible-galaxy dependency resolution (#77468)
* Limit Galaxy API calls during ansible-galaxy collection dependency resolution when possible

Installing a tarfile with a dependency from a Galaxy server (e.g. dependencies: {'ns.coll': '>=1.0.0'}) does not get the available versions of the dependency from the galaxy server if a sufficient version is already installed.

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2 years ago
Brian Coca dc2a79f1c3
ansilbe-doc fixes for filters/test listing (#78696)
* split filters
* listing fixes
* return to no docs being exception
2 years ago
Matt Clay 38a82a5cc4
ansible-test - Remove Fedora 35 support. (#78720) 2 years ago
Sam Doran 8ebca4a6a3
fetch_file - properly split files with multi-part file extensions (#75257) 2 years ago
Martin Krizek fd19ff2310
Propagate ansible_failed_task to an outer rescue (#78676)
Fixes #43191
Fixes #72638
Fixes #78042

Co-authored-by: Sandra McCann <samccann@redhat.com>
2 years ago
Brian Coca 72783837c5
fix issue with legacy pugins and no docs (#78686)
* fix issue with legacy pugins and no docs
2 years ago
Sloane Hertel 5f2bb2ba93
Add the rest of the runtime keys to the example in the default collection skeleton (#78573) 2 years ago
Brian Coca 4260b71cc7
refactor and fixes for doc parsing (#77719)
* refactor and remove redundant code in documentation

  allow location and building api to be more accessible
  fix issues with displaying ansible.legacy and ansible.builtin
  ensure we don't x2 process tokens (some modules reference them also) fixes #77764
  move to constants vs hardcoded
  more informative errors and comments
  now have actual filter/test plugins, which expose the filter/test functions
  moved filter/test loading/finding logic into jinja2pluginloader, removed dupe implementations
  added tests for case in which we unique by basename when listing

Update lib/ansible/utils/plugin_docs.py
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Sloane Hertel 2464e1e91c
Fix vars plugin code and documentation mismatch (#78562)
* Add a warning for collections that are attempting to be autoloaded to no effect
* Deprecate REQUIRES_WHITELIST and add support for REQUIRES_ENABLED so the docs are accurate
* Fix documentation
* add more vars plugin tests
* Simplify code and add a FIXME for another bug
* fix precedence
* Make setting the class attr at all a warning, even if it's True
* Add fun parsing for _load_name
* include _load_name in messages
2 years ago
Martin Krizek 19e7c5b0c1
_get_next_task_from_state should not mutate anyting outside of state (#78657)
Fixes #78612
2 years ago
Matt Martz d8cb9117ac
Skip test if no there are no problematic chars for wcswidth (#78645) 2 years ago
Sloane Hertel 12cec69545
Fix validate-modules version_added test (#78554) 2 years ago
Sviatoslav Sydorenko f1c56e988d Fail fast in stuck `ansible-galaxy-collection`
This specific integration test gets stuck periodically causing the
Galaxy jobs to be killed on timeout wasting an hour of runtime. The
module that gets stuck waiting on Pulp is an in-test one, called
`setup_collections`. When it works, the task is complete in around 70
seconds but when it doesn't, it just freezes the whole play.

This patch attempts to make it fail faster by putting a reasonable
timeout value of 2 minutes.
2 years ago
Matt Clay 38db9cf417
ansible-test - Update test containers. (#78615)
The test containers no longer use the `VOLUME` instruction.
2 years ago
Matt Clay 4187707f03
ansible-test - Use --tmpfs to run containers. (#78605) 2 years ago
Matt Clay 2e536c0afb
Fix file integration test chattr/lsattr check. (#78614)
On BusyBox systems such as Alpine, chattr on a tmpfs fails with a status of 0 and output only on stderr.

This change updates the test to not assume output on stdout.
2 years ago
Matt Clay ece85abbc4
ansible-test - Verify executables are executable. (#78606) 2 years ago
Sviatoslav Sydorenko beb70daf14 Fix pytest collection during test_host partial run
Sometimes pytest errors out with an `ImportError` during its tests
collection stage when a Python package/directory containing the test
module does not have an `__init__.py` in it. This is being observed
under Python 3.9 and higher.

The patch provides a workaround for this problem but does not address
the root cause which is currently unknown.

Ref:
https://github.com/ansible/ansible/pull/78585#issuecomment-1220885431
2 years ago
Martin Krizek 42d8a9daa8
Prevent double failing hosts for includes in loops (#76928)
Fixes #23161
2 years ago
Matt Martz deb54e4c5b
Relax minimal config to enable manifest functionality (#78574)
* Revert "Fix incorrect docs about how to enable manifest functionality (#78572)"

This reverts commit ac1ca40fb3.
2 years ago
Matt Martz d2f8099118
Use MANIFEST.in style directives to build collections (#78422) 2 years ago
Elijah DeLee f9a450551d
add required file to collection skeleton (#77418)
* add required file to collection skeleton

This file is required to be able to upload a collection.

It is present in
https://github.com/ansible-collections/collection_template/blob/main/meta/runtime.yml
but that does not get used by default.

Without this, if you use the "ansible-galaxy collection init" command
and you try and publish that collection without adding this file, you
get the error:

"ERROR! Galaxy import process failed: 'requires_ansible' in
meta/runtime.yml is mandatory, but no meta/runtime.yml found (Code:
UNKNOWN)"

Also updates relevant test and adds a changelog fragment
2 years ago
Kate Case bf1ef5a1f3
Replace get_persistent_connection_options in task_executor with get_options (#74446)
Replace get_persistent_connection_options with get_options
Remove special case for network sub_plugin in _set_plugin_options
Try to avoid mock connection pretending to be persistent
Rename variables->options to reflect what they actually are
Gather options for ssh_type_conn on network_cli
Drop reliance on sub_plugin["type"]
2 years ago
Martin Krizek 811093f022
Move handler processing into new PlayIterator state (#77955)
Fixes #46447
Fixes #52561
Fixes #54991
Fixes #64611
Fixes #64999
Fixes #65067
Fixes #72725
Fixes #72781
Fixes #77616
2 years ago
Matt Clay d683c5bd21
ansible-test - Fix Ubuntu 20.04 bootstrapping. (#78551) 2 years ago
Matt Clay 8e96c27888
ansible-test - Update base and default containers. (#78532) 2 years ago
Matt Clay 69ceb31600
ansible-test - Update sanity test requirements. (#78528) 2 years ago
Matt Clay 135f95fb2f
Split up ansible-test integration tests. (#78520)
* Relocate venv-pythons.py script.

* Split out unsupported-directory test.

* Split out sanity-import test.

* Split out sanity-validate-modules test.

* Split out units test.

* Split out integration test.

* Split out units-constraints test.

* Split out integration-constraints test.

* Split out coverage test.

* Split out sanity test.

* Split out git test.

* Update test groups.
2 years ago
Brian Coca 0de4480467
allow multiple types for null representation (#78451)
* allow multiple types for null representation

  '' is not Nonetype
  fixes #76493
2 years ago
Matt Clay 99016653a2
ansible-test - Fix self-test change handling. (#78521) 2 years ago
Matt Martz 86298b7a47
Fix --role-file arg detection (#78475)
* Fix --role-file arg detection. Fixes #78204

* Do not traceback, give better error

* Add coverage for compound shortopts to match -r. Fixes #78491
2 years ago
Sloane Hertel 3add5e9321
Fix apt making changes in check mode (#78496)
* Don't actually update the cache in check mode

Add tests for updating the cache in check mode

* Don't mark packages as manually installed in check mode and add a test for it

* changelog

* Update test/integration/targets/apt/tasks/apt.yml

* fix test
2 years ago
Matt Clay 2b63fdd1b8
ansible-test - Fix ansible-doc sanity test FQCN. (#78518) 2 years ago
Matt Clay 2fedde6356
ansible-test - Update distro test containers. (#78506) 2 years ago
Matt Clay 8367af9cdd
ansible-test - No locale warning with delegation. (#78505)
The locale warning for the origin host is not relevant when delegation is used.
It is also not relevant when non-test commands are in use.
2 years ago
Matt Clay 47804fcdf5
ansible-test - Update coverage to 6.4.3. (#78504) 2 years ago
Matt Clay 9ee183c4b9
Clean up unit tests. (#78498) 2 years ago
Matt Clay 89862fda3b
ansible-test - Sanity test code cleanup. (#78497) 2 years ago
Matthew Donoughe 3f1838bf91
Update attributes of files that are links without specifying link target (#76167)
* update attributes of files that are symlinks

* update attributes of files that are hard links

* fix default state in documentation

* remove unnecessary suppression

* add to changelog
2 years ago
Matt Clay 650befed37
Add missing space after keywords. (#78480)
Also remove unnecessary parenthesis.
2 years ago
Patrick Hemmer 04e8927579
apt: include apt preferences (e.g. pinning) when selecting packages (#78327)
Fixes #77969
2 years ago
Matt Clay 85acf4d1e5
ansible-test - Avoid use of deprecated type hints. (#78456)
* ansible-test - Avoid use of deprecated type hints.

PEP 585 deprecated many container types in the `typing` module in favor of the actual types, which support subscripting as of Python 3.9.

Conversion of `t.Type` was skipped since PyCharm does not currently recognize it.

* ansible-test - Fix `t` and `c` imports/shadowing.
2 years ago
Matt Clay 5bee66fc5d
ansible-test - More type hint updates. (#78455)
* Simple regex replace of multi-line function arg annotations on the first line.

* Manually fix up ArgumentParser type annotations.

* Manual type hint conversions.

* Manual conversion of function type hints.

* Remove unnecessary type hints on for statements.
2 years ago
Matt Clay b993b5cd49
ansible-test - Convert more type hints. (#78449)
* Simple regex replace of multi-line function arg annotations.

* Simple regex replace of multi-line function arg annotations with default values.

* Simple regex replace of multi-line function arg return annotations.

* Simple regex replace of assignment annotations.
2 years ago
Matt Clay 02e98810a9
Re-organize CI test groups for POSIX tests. (#77420)
* `context/target` tests must be in groups 1 - 2.
* `context/controller` tests must be in groups 3 - 5.

This makes it easier to efficiently organize groups and balance test runtimes.
2 years ago
Matt Clay 3eb0485dd9
ansible-test - Use more native type hints. (#78435)
* ansible-test - Use more native type hints.

Simple search and replace to switch from comments to native type hints for return types of functions with no arguments.

* ansible-test - Use more native type hints.

Conversion of simple single-line function annotation type comments to native type hints.

* ansible-test - Use more native type hints.

Conversion of single-line function annotation type comments with default values to native type hints.

* ansible-test - Use more native type hints.

Manual conversion of type annotation comments for functions which have pylint directives.
2 years ago
Matt Clay f2abfc4b3d
ansible-test - Parse content config only once. (#78418) 2 years ago
Jordan Borean ad79c1e0d0
Add support for json in adhoc -a (#78114)
Co-authored-by: Sandra McCann <samccann@redhat.com>
2 years ago
Matt Clay d8fefba20e
ansible-test - Update locale logic to match core. (#78389)
Now that core requires UTF-8 filesystem encoding, ansible-test does as well.

Additionally, the `en_US.UTF-8` or `C.UTF-8` encoding must be available.
Previously the `en_US.UTF-8` encoding was requested, but its availability was never verified.
The fallback to `C.UTF-8` maintains UTF-8 encoding while allowing more flexibility in the running environment.
2 years ago
Sloane Hertel 05608b20e8
Fix listing collections that are missing the metadata required by build (#76596)
* Rethread pr/70185 through the dependency resolver

Hang optional metadata toggle on the ConcreteArtifactsManager instead of threading it through whole list codepath

Don't error while listing collections if a collection's metadata is missing keys required for building a collection.

Give an informative warning if metadata has been badly formatted.

Co-authored-by: Sam Doran <sdoran@redhat.com>
2 years ago
Brian Coca 9b79d6ba35
config error origin (#78407) 2 years ago
Sloane Hertel a2174fc6d9
Fix removing existing dir/files with `ansible-galaxy collection init --force` (#78403)
* Remove collection contents when re-initializing with --force


Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2 years ago
Martin Krizek ce6c9befb8
Do not allow handlers from dynamic includes to be notified (#78399)
* Do not allow handlers from dynamic includes to be notified
2 years ago
Matt Martz f6d2b18322
Correctly get the filename from a url in fetch_file. Fixes #29680 (#78383) 2 years ago
Matt Clay b0b58fa7c2
ansible-test - Update base and default containers. (#78377) 2 years ago
Matt Clay 234938cd76
Change the language used in the unarchive test. (#78382)
The current language pack fails to install on Ubuntu 22.04.
However, since the langauge only needs to be non-English, changing it preserves the test functionality.
2 years ago
Matt Clay cc5c706681
Update unit test controller requirements. (#78376) 2 years ago
Matt Clay f5c01a8b6e
Remove unit test Python 2.6 compat. (#78369) 2 years ago
Matt Clay b86a18bd27
Remove unit test pytz requirement. (#78368) 2 years ago
Matt Davis 1368bfa348
PluginLoader now installs module-to-be-imported in sys.modules before exec (as Python import does). (#78364) 2 years ago
Ruediger Pluem 0ef1376966
Make distro.id() report newer versions of OpenSuSE (at least >=15) also report as opensuse (#76121)
* Report OpenSuSE >= 15 as opensuse

Make distro.id() report newer versions of OpenSuSE (at least >=15) also report
as opensuse. They report themselves as opensuse-leap.

* Add a test
2 years ago
Matt Clay a3c90dd0bc
ansible-test - Fix TTY and output handling. (#78350) 2 years ago
Sloane Hertel 5728d72cda
Fix KeyError for ansible-galaxy when caching paginated responses from v3 (#78325)
* Fix KeyError for ansible-galaxy when caching paginated responses from v3

* changelog

* generate responses in loop for test

Co-authored-by: Matt Martz <matt@sivel.net>
2 years ago
Matt Martz 1429672213
Add pep440 version_type for version test (#78308) 2 years ago
Matt Martz 9d4ced1237
wait_for - Read file and perform comparisons using bytes to avoid decode errors (#78317)
* wait_for - Read file and perform comparisons using bytes to avoid decode errors. Fixes #78214

* Write non-ascii via script instead of static file

* Use contexlib.closing to support py27 context manager

* Use executable from task, instead of shebang

* Update encoded bytes to utf16
2 years ago
Matt Clay 0012263c7a
ansible-test - Fix handling of args after `--` (#78328) 2 years ago
Matt Clay 61af59c808
ansible-test - Update distro containers to 4.4.0. (#78322) 2 years ago
Matt Clay 4cd3425dfe
ansible-test - Update coverage to 6.4.2 (#78320) 2 years ago
Martin Krizek b56b38b3ba
Use classproperty to access field attributes of a class (#78180)
* Use classproperty to access field attributes of a class, consolidate into one class
2 years ago
Matt Clay 90ef914f77
ansible-test - Drop Python 3.8 controller support. (#78237) 2 years ago
Matt Clay 681c32ec65
Fix fetch integration test on macOS. (#78314)
The test can now run split.
2 years ago
Matt Clay 61ea6c4a5b
Fix expect integration test. (#78315)
The test can now run split on macOS.
2 years ago
Matt Clay 27d39be580
Fix become integration test. (#78313)
* Don't set become_flags in become integration test.

Setting the flags in the test overrides the default value in the become plugins, which was not intentional.

* Remove hack for broken implicit tilde support.

It was only broken because the tests were overriding the default become flags for sudo.

* Simplify assertions.
2 years ago
Sviatoslav Sydorenko 619a1fa7e2
Drop custom repo from libuser install @ Alpine CI (#78305)
`group` and `setup_cron` integration tests currently install `libuser` and `faketime`
packages respectively, from the non-default edge/testing repositories. It is no
longer necessary to do so for the former so this patch drops the repo option. As
for the latter, this patch includes a note explaining when the same could be done
for it too.

This patch also adds a note on installing `faketime` on Alpine in CI.

Co-Authored-By: Matt Clay <matt@mystile.com>
2 years ago
Matt Clay de2163b160
Overhaul become integration tests. (#78312) 2 years ago
Matt Clay f3f4ad9332
ansible-test - Use sudo for all remotes. (#78310) 2 years ago
Matt Clay 8565deaae3
ansible-test - Install `acl` on Alpine remotes. (#78303) 2 years ago
Matt Clay 8bb20fe06b
ansible-test - Enable ACL support on more remotes. (#78299) 2 years ago
Matt Clay 9b42f9befe
Revert "Re-enable strategy units (#78293)" (#78300)
This reverts commit c6c9d90ca4.
2 years ago
Matt Martz c6c9d90ca4
Re-enable strategy units (#78293) 2 years ago
Matt Clay ee4588abca
Split integration test fixes. (#78281)
* Add setup_test_user integration target.

This integration target creates a temporary test user and removes
it when the current integration target finishes. This user is
configured with a password so it can be used with become, even
when the current user is unprivileged.

* Fix slurp integration test.

* Fix unarchive integration test.

* Fix module_utils integration test.
2 years ago
Matt Clay b63812bc08 ansible-test - Enable ACLs on FreeBSD remotes.
This allows integration tests to switch from one unprivileged user
to another, sharing files between the users using ACLs.
2 years ago
Martin Krizek d070b03ad8
Fix templating nested vars with convert_data=False (#78273)
Regression introduced in #78259.
2 years ago
Martin Krizek 9afdb7fec1
template module/lookup: fix convert_data for macros (#78259)
Fixes #78141
2 years ago
James Livulpi d635b871d1
Cleanup write_file method in uri (#76412) 2 years ago
Matt Martz d58e69c82d
Add support for gzip decoding responses (#41925) 2 years ago
zorun a6e671db25
Fix AIX processor facts and add unit test (#78223)
- `processor_count` was erroneously set to the number of cores
- `processor_cores` was erroneously set to the number of threads per core
- `processor_vcpus` and `processor_threads_per_core` were not set
- `processor` was a string, while it's supposed to be a list

Before:

```
"ansible_processor": "PowerPC_POWER7",
"ansible_processor_cores": 4,
"ansible_processor_count": 12,
```

After:

```
"ansible_processor": [
    "PowerPC_POWER7"
],
"ansible_processor_cores": 12,
"ansible_processor_count": 1,
"ansible_processor_threads_per_core": 4,
"ansible_processor_vcpus": 48,
```

Also add a unit test.

Co-authored-by: Baptiste Jonglez <git@bitsofnetworks.org>
2 years ago
Matt Clay b85bcd7abf
Fix module_utils_common.respawn test. (#78248)
The respawn failure can be returned on either stdout or stderr.
2 years ago
Kay Yan 2e4b0fefbf
Added Kylin Linux Advanced Server Support (#78232) 2 years ago
Jordan Borean 75de4a37bc
validate-modules - allow raw module return type (#78231) 2 years ago
Martin Krizek 2bc2153c01
yum: fix releasever for latest (#78066)
Fixes #78058
2 years ago
Matt Martz b1dd2af4ca
Preflight utf8 encodings check (#78175) 2 years ago
Brian Coca d26801e994
Fix wording for :ref|term: substitution (#78216)
* Fix workding for :ref|term: subsitution

 now matches 'seealso' and makes more sense:

  ```
  delay:
  applies_to:
  - Task
  description: Number of seconds to delay between retries. This setting is only used
    in combination with `until`.
  ```
 vs
  ```
  delay:
  applies_to:
  - Task
  description: Number of seconds to delay between retries. This setting is only used
    in combination with website for `until`.
  ```

* updated unit tests

* match see also

* more sanity
2 years ago
Martin Krizek 17d52c8d64
Move undefined check from concat to finalize (#78165)
* Move undefined check from concat to finalize

In the classic Jinja2's Environment str() is called on the return value of the
finalize method to potentially trigger the undefined error. That is not
the case in NativeEnvironment where string conversion of the return value is
not desired. We workaround that by checking for Undefined in all of our concat
functions. It seems simpler to do it earlier in the finalize method(s) instead.
As a side-effect it fixes an undefined variable detection in imported templates.

Fixes #78156

ci_complete

* Fix sanity

* ...

* sigh
2 years ago
Sloane Hertel 1562672bd1
Make unit test for missing git executable more generic (#78173)
* Make unit test for missing git executable more generic

* use MagicMock side_effect to raise exception instead
2 years ago
LRitzdorf 6bcb494f83
[dnf] Fix skip_broken, add test coverage (v2) (#78158)
* [dnf] Fix skip_broken, add test coverage

Change:
- skip_broken was set in config but not actually used in calls to
  base.install()
- added a lot of test cases with specialized repo
- got rid of external (docker repo) nobest test cases since the
  specialized repo works well for those too
- Slight cleanup and adding comments in dnf module

Test Plan:
- ci_complete

Tickets:
- Fixes #73072

Original-author: Rick Elrod <rick@elrod.me>

* Use a better test for checking results list

ci_complete

Signed-off-by: Rick Elrod <rick@elrod.me>

Co-authored-by: Rick Elrod <rick@elrod.me>
2 years ago
Matt Clay f70cc2fb7e
Refactor ansible-test integration tests. (#78168)
* Relocate update-ignore.py for easier re-use.

* Add script to ease collection testing.

* Skip ignore rewrite if file does not exist.

* Add integration test for the shebang sanity test.

* Fix ansible-test-no-tty integration test.

Previously the test only verified a TTY was not used if a TTY already existed.
This prevented the test from verifying behavior when run in CI.
Now the test creates a PTY before invoking ansible-test.

* Clean up ansible-test-docker integration test.
2 years ago
Matt Martz bcdc2e167a
Support for Python 3.11+ tomllib for inventory (#77435) 2 years ago
Martin Krizek 43153c5831
`FieldAttribute`s as descriptors (#73908) 2 years ago
Matt Clay 4594c0c609 Fix HTTP tests on FreeBSD when running split. 2 years ago
Matt Clay b9d13d222c ansible-test - Improve pip bootstrap download. 2 years ago
Brian Coca fa35aa4865
Galaxy server config updates (#77106)
* ansible-galaxy configurable timeouts

  - also fixed issues with precedence,
    so --ignore-certs now overrides config
  - made galaxy_timeout generic setting,
    if set, it becomes default for server configs,
    but now specific servers can override
  - updated tests or added notes (some tests ignore/override precedence)

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Sviatoslav Sydorenko e481b35e23
Delete core-ci `query` param from ansible-test (#78136)
Ref: https://github.com/ansible/ansible-core-ci/pull/343
2 years ago
Matt Clay ca04dc28a2 ansible-test - Remove deprecated test platforms. 2 years ago
Brian Coca cea18bf60a
password lookup argument parsing fix (#78080)
fixes #78079
2 years ago
Matt Clay cf9fd2d7da ansible-test - Use shlex.join where appropriate. 2 years ago
Matt Clay 24d91f552c ansible-test - Add support for more remotes. 2 years ago
Matt Clay 5666c6d6a3 ansible-test - More flexible become support. 2 years ago
Chris James ea351f0ae2
user - Use -n instead of -N for luseradd on all distros (#75042)
* Use -n instead of -N for luseradd on all distros

Co-authored-by: Chris James <git@etcet.net>
2 years ago
Don Naro 3cd2c494bd
issue #72449 winrm script rm (#77931) 2 years ago
Matt Martz 18992b7947
Add new `loop_control.extended_allitems` option (#75760)
* Add new `loop_control.extended_allitems` option. Fixes #75216

* Add test for extended_allitems

* docs code block fix
2 years ago
Matt Martz a90f666ab3
Use ctypes to access shadow, instead of spwd which is deprecated (#78050)
* Use ctypes to access shadow, instead of spwd which is deprecated

* Remove sanity ignore

* cast to str to satisfy mypy

* Add typing.cast polyfill

* Appease mypy redefine

* Add clog frag
2 years ago
David Moreau Simard d81a519f25
Remove .travis.yml files from galaxy init skeletons (#75740)
* Remove .travis.yml files from galaxy init skeletons

These files have existed for many years but in light of the recent
circumstances around Travis, we should not include them by default in
the galaxy init skeletons.

* Add breaking_changes changelog fragment with recommendation to use a custom skeleton if the .travis.yml file is still needed.

Co-authored-by: s-hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Matt Clay 95df5cb740 Fix invalid-ansiblemodule-schema sanity errors.
The validate-modules sanity test expects a list not a dict_keys iterable.
2 years ago
Matt Clay 2f0530396b ansible-test - Clean up type hints and comments. 2 years ago
Matt Clay 5f5c4ef2ef Remove incidental_inventory_foreman test. 2 years ago
Matt Clay a4e4413cde ansible-test - Update distro containers to 4.3.0.
The primary change in this update is removal of `/etc/ansible/hosts` from the containers.
2 years ago
Matt Clay 5b3557f8ba ansible-test - Allow docstring in docs-only module 2 years ago
Matt Clay c2b36ba04d ansible-test - Update base and default containers. 2 years ago
Matt Clay 23914d3f0b
ansible-test - Adjust unit test mock usage. (#77961) 2 years ago
Sloane Hertel e059dde9fb
Add missing inventory cache test (#77990)
Fix intentional coverage to replace incidental_inventory_foreman

ci_complete
ci_coverage
2 years ago
Sloane Hertel 9d6cc7b576
unarchive - fall back to unzip -Z if zipinfo is not available (#76971)
Add a new handler class ZipZArchive to use unzip -Z as an alternative to zipinfo

Run 'unzip -Z' in can_handle_archive so we fall back to the next handler if it's not available (failing in is_unarchived is too late)

* Add a test for unzip -Z when zipinfo is not available

* Update test for missing binary altogether by removing /usr/bin from the PATH
2 years ago
Sloane Hertel a43112290a
fix ansible-galaxy-collection test with revoked key (#77989)
* Remove unnecessary gpg passphrase
2 years ago
Sloane Hertel e89176caac
Pin PyYAML version compatible with Python 3.8+ (#77936)
Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
Co-authored-by: Matt Clay <matt@mystile.com>
2 years ago
Matt Martz 5e369604e1
Forked display via queue (#77056)
* Forked Display via queue

* Docs and simple code cleanup

* Only proxy Display.display

* Remove unused import

* comment

* Update deadlock comment, remove py3 check

* Don't flush display, and don't lock from forks

* clog frag

* ci_complete ci_coverage

* Add units for queue proxying

* Cleanup flush

* ci_complete

* Only lock the write, switch to RLock

* Remove unused import
2 years ago
Sloane Hertel 143e7fb45e
ansible-galaxy - support resolvelib versions >= 0.5.3, < 0.9.0 (#77649)
* ansible-galaxy - support resolvelib versions >= 0.5.3, <= 0.8.1

Test incompatibilities are removed for resolvelib >= 0.6.0

Test against the latest 0.8.x version and fix requirements

* Fix tests - use a venv for testing the range of resolvelib versions

* Update temporary hardcoded fallback for ansible-test

* Update hardcoded upperbound for sanity tests

* Make error check more flexible
2 years ago
Matt Clay df765c0ecf ansible-test - Update Alpine, openSUSE containers 2 years ago
Matt Clay fe2d8b7066 Skip libuser tests on openSUSE 15.4+
The libuser package is not available.
2 years ago
Matt Clay e31e918e04 Don't install lgroupadd for SUSE tests.
It's not used by the tests and is not available as of openSUSE 15.4.
2 years ago
Brian Coca 89c6547892
preserve add_host/group_by on refresh (#77944)
* preserve add_host/group_by on meta: refresh_inventory

Co-authored-by: Jordan Borean <jborean93@gmail.com>
2 years ago
Matt Clay 52c8613a04 ansible-test - Skip mypy runs under Python 3.11. 2 years ago
Matt Clay 11b6032e73 ansible-test - Ignore vendored code in mypy test. 2 years ago
Sloane Hertel 6c6a7851ed
Add inventory cache integration tests (#77895)
* Add intentional coverage for incidental_inventory_foreman coverage cache tests

ci_complete
ci_coverage
2 years ago
Matt Clay 5391150b30 Integration tests for invalid group name. 2 years ago
Sloane Hertel 1706d35fc4
ansible-galaxy-collection - use --pinentry-mode loopback for gpg key revocation (#77967) 2 years ago
Sloane Hertel c908d782fb
get_url - permit to have a checksum only file (#77948)
checksum can also accept a checksum only file (no filename beside the checksum).
fixes #54390

Co-authored-by: Baptiste Mille-Mathias <baptiste.millemathias@gmail.com>
2 years ago
Sloane Hertel f270b4e224
Fix items2dict errors for incorrect list item type and missing keys (#77946)
* Fix items2dict errors for incorrect list item type and missing keys

* keep dict comprehension
2 years ago
Martin Krizek 058a69e6b0
Properly send a skipped message for empty templated loop (#77945)
Fixes #77934
2 years ago
Matt Clay 81351022d8 ansible-test - Prefer unittest.mock for core. 2 years ago
Matt Clay f933314101 ansible-test - Fix shell target options handling. 2 years ago
Matt Clay 86779cc903 ansible-test - Code cleanup.
This helps prepare for a future pylint upgrade.
2 years ago
Sloane Hertel e6075109d0
Remove incidental_inventory_aws_ec2 and supporting plugins (#77877)
* Remove aws/2.7 and aws/3.6 from incidental test matrix entries

* Remove aws.sh symlink
2 years ago
Matt Clay bd849b3076 Fix ansible-runner integration tests. 2 years ago
Sandra McCann f3c684564c
Remove platform dev guides from core docs (#77915) 2 years ago
Julien Lecomte 33beeace10
Fix lusermod using a group name and not id (#61965) (#77914)
* Fix lusermod using a group name and not id (#61965)
2 years ago
Matt Clay e259317c3e
Remove incidental_inventory_docker_swarm tests. (#77924)
ci_complete
ci_coverage
2 years ago
Sloane Hertel 1214b63f4f
Fix 'ansible-config dump --only-changed -t all' verbosity (#77898)
* Fix 'ansible-config dump --only-changed -t all' to only display headers if plugin options are changed

* changelog

* add a test
2 years ago
Matt Clay 43d650f924
Add RHEL 9.0 to CI. (#77853)
* Add RHEL 9.0 to CI.

* Restrict network manager inspection to RHEL8

* Skip module tests when astream_name is undefined, undefine it for RHEL9 until 9.1

* Remove redundant test.

Co-authored-by: Matt Martz <matt@sivel.net>
2 years ago
Wouter Schoot 711b51fad6
Remove double spaces in errormessage (#77839) 2 years ago
Matt Clay 289cba333b ansible-test - More multi-arch containers. 2 years ago
OscarBell 74eb8b779d
Blockinfile multiline search (#75090) 2 years ago
Matt Martz e7e1d592a6
Incidental coverage 1 (#77846)
* Add find test to assert patterns with regex

* Add test to assert that nested includes with relative path work

* Add test to assert symmetric_difference supports unhashable types

* ci_complete ci_coverage

* Add test to assert JSON values are converted to Python

* Add test to assert how unexpected module failures behave

* Add test to verify remote_is_local

* ci_complete ci_coverage

* Get real path of local tmp

* ci_complete ci_coverage

* Expanded symmetric_difference tests

* ci_complete ci_coverage

* I don't even know

* ci_complete ci_coverage

* Revert mathstuff changes

* ci_complete ci_coverage
2 years ago
Brian Coca f7d7604454
Add uri, urn and url test plugins (#77423)
and docs!

Co-authored-by: Tabah Baridule <dulemartins07@gmail.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
2 years ago
Ian Wienand e4c0bbf885
apt: fix virtual package install version detection (#76781)
* apt: fix virtual package install version detection

Change 4a62c4e3e4 introduced version
matching in installation.

The problem stems from

 if version_installable or version:
     pkg_list.append("'%s=%s'" % (name, version_installable or version))

When the package is a virtual-package, package_status() is returning
the "version_installable" of the package *satisfying* the
virtual-package; but then this is trying to install the
virtual-package with this version pin.

For example, "yaml-mode" is a virtual package satisifed by
"elpa-yaml-mode" (currently 0.0.14-1) and trying to install it fails
with

 $ usr/bin/apt-get -y ... install 'yaml-mode=0.0.14-1'
 ... failed: E: Version '0.0.14-1' for 'yaml-mode' was not found ...

In the case of a virtual-package with nothing installed to satisfy it,
we should just return blank values to allow apt-get to do it's thing.

The tests are updated to install and remove this package.

Fixes: #76779
2 years ago
Sloane Hertel 82f3a57bee
Fix ansible-galaxy traceback when unexpected version of resolvelib is installed (#77630)
* Fix traceback when a supported version of resolvelib is not installed

Try to read the supported version range from the package distribution info and fall back to a hardcoded lowerbound/upperbound (>=0.5.3,<0.6.0).

* Add tests for unsupported resolvelib versions

* Resolve remaining import sanity test issues.

Co-authored-by: Matt Clay <matt@mystile.com>
Co-authored-by: Matt Martz <matt@sivel.net>
2 years ago
Sloane Hertel 621e782ed0
Add toggle to fix module_defaults with module-as-redirected-action on a per-module basis (#77265)
* If there is a platform specific handler, prefer the resolved module over the resolved action when loading module_defaults

Add a toggle for action plugins to prefer the resolved module when loading module_defaults

Allow moving away from modules intercepted as actions pattern

Fixes #77059
2 years ago
Matt Clay 2595b42aca
Prefer unittest.mock over mock. (#77886) 2 years ago
Matt Clay 3a9a23fb1a
Use unittest.mock instead of mock. (#77883)
This can only be done for controller tests.
2 years ago
Sloane Hertel 1eb7f71f0e
Replace incidental_inventory_aws_ec2 with intentional coverage (#77743)
* Add intentional test coverage for lib/ansible/plugins/inventory/__init__.py

* Add intentional (integration) test coverage for lib/ansible/module_utils/common/network.py

* Add ansible_release info test from https://github.com/ansible/ansible/pull/74673

ci_complete
ci_coverage

Co-authored-by: Rick Elrod <rick@elrod.me>
2 years ago
Sloane Hertel 400475acc0
validate meta/main.yml dependencies and meta/requirements.yml are both lists before concatenating them together (#77821) 2 years ago
Matt Clay 13d03c3c22
ansible-test - Add RHEL 9 / FreeBSD 13.1 remotes. (#77851) 2 years ago
Matt Clay 3d2c2e60aa
ansible-test - Update distro containers. (#77847)
* ansible-test - Add a Ubuntu 22.04 container.
* ansible-test - Add a Fedora 36 container.
* ansible-test - Update distro containers.
* Fix dnf test on Fedora 36.
* Work around scp test issues.
2 years ago
Matt Martz ef3ea4cdc3
Incidental docker chip away (#77830)
* Add new templating target, test splitter

* Add test for host:port parsing in parse_address via add_host

* Test already notified listening handler

* Add test for gathering bridge network facts

* Add veth to bridge

* ci_complete ci_coverage
2 years ago
Matt Clay 76ead1e768 ansible-test - Fix remote args restriction.
The platform-specific and global fallbacks were not working with the `--remote` option.

This regression was introduced by https://github.com/ansible/ansible/pull/77711
2 years ago
Matt Clay 185340e667 ansible-test - Update default containers.
These containers include Python 3.11 sanity test environments.
2 years ago
Matt Clay dfde4be444 Add Python 3.11 support.
ci_complete
ci_coverage
2 years ago
Matt Clay 8ca28acd0d Fix unit tests for Python 3.11. 2 years ago
Matt Clay 5f74350fd5 Avoid deprecated method in unit tests. 2 years ago
Matt Clay 9600e3064a
ansible-test - Improve requirements handling. (#77825)
The requirements for virtualenv and coverage are now kept in a requirements file for easier container builds.

The test-constraints sanity test has been updated to make sure the requirements file is kept up-to-date.
2 years ago
Sloane Hertel fecc78b5fb
remove extra validate-modules ignore entry (#77826) 2 years ago
Brian Coca 4706091a38
rename systemd module to services only (#77644)
* rename systemd module to services only

 disambiguates what it handles since systemd is now much more
 that a service manager, but the module is specific to services
2 years ago
Joseph Torcasso c9ce7d08a2
template/__init__.py - fix KeyError when wantlist=False with non-list 2 years ago
Brian Coca 5e50284693
Restrict role loading .. to role ... (#77683)
* Ansible will now error out if you try to use the `*_from` to load files from outside the role being loaded by `{import,include}_role`
2 years ago
Matt Clay 290fb5e0ca
ansible-test - Upgrade to coverage 6.3.3. (#77817) 2 years ago
Martin Krizek e9af6efee6
Raise a proper error when include/import_role is used as a handler (#77807) 2 years ago
Matt Clay 1e3cf9f732
ansible-test - Make distro containers multi-arch. (#77814) 2 years ago
Abhijeet Kasurde 524d30b8b0
distribution: add distribution_minor_version for Debian Distro (#74721)
* Added a fact about minor version details for Debian Distro

Fixes: #74481

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2 years ago
Matt Clay 449d82a521 ansible-test - Add RHEL 8.6 support. 2 years ago
Matt Clay fe349a1ccd
ansible-test - Enhance the shell command. (#77734)
* ansible-test - Add shell --export option.

* ansible-test - Support cmd args for shell command.

Also allow shell to be used without a valid layout if no delegation is required.

* ansible-test - Improve stderr/stdout consistency.

By default all output goes to stdout only, with the exception of a fatal error.

When using any of the following, all output defaults to stderr instead:

* sanity with the `--lint` option -- sanity messages to stdout
* coverage analyze -- output to stdout if the output file is `/dev/stdout`
* shell -- shell output to stdout

This fixes issues two main issues:

* Unpredictable output order when using both info and error/warning messages.
* Mixing of lint/command/shell output with bootstrapping messages on stdout.

* ansible-test - Add changelog fragment.
2 years ago
s-hertel fbc5b3f9c5 fix copy test for split controller/remote 2 years ago
s-hertel 3f4cacd355 Remove MacOSX-specific cleanup for unarchive test 2 years ago
Matt Clay cc5ac88c4c Update mypy test. Fix type hints for Python 3.9.
This also bumps the minimum controller version (for mypy only) to Python 3.9.
2 years ago
Matt Clay 2cc74b04c4 ansible-test - Add multi-arch remote support. 2 years ago
Matt Clay de5d6820f8 ansible-test - Remove obsolete code. 2 years ago
Matt Clay a115a7fce2 Install acl on Ubuntu for copy integration test. 2 years ago
Matt Clay e2200e8dfc ansible-test - Fix remote completion validation. 2 years ago
Matt Davis 4ff10fcd31 fix SELinux facts tests
* make the pre-flight sniffing more robust to different failure conditions (was failing on Ubuntu 22.04 VMs)
* remove skip aliases (the test needs to function everywhere to assert that the selinux facts bits behave properly when it's N/A)
2 years ago
Matt Clay 6513453310 ansible-test - Add support for remote Ubuntu VMs. 2 years ago
Matt Clay dcda1e7239 Trim message in split integration test. 2 years ago
Martin Krizek dbdbfe845a
Remove deprecated subclassing DefaultCallback without doc_fragment (#77677) 2 years ago
Brian Coca a3cc6a581e
dont rely on path to set config defs for plugins (#77659) 2 years ago
Martin Krizek ed30fc9a06
Remove deprecated loading cache plugins directly without cache_loader (#77655) 2 years ago
Martin Krizek 572bc1354a Fix lazy eval version in integration tests 2 years ago
Brian Coca 749a105956
ansible-doc stay 3.8 python compatible (#77682)
pathlib with_stem will wait till 3.9
  also add tests by listing filters
2 years ago
Matt Clay cc872a57f2 Reduce output from ansible-doc integration test.
This removes about 20K lines of output which are not evaluated as part of the test.
2 years ago
Matt Clay 5c2d830dea
ansible-test - Fix subprocess management. (#77641)
* Run code-smell sanity tests in UTF-8 Mode.
* Update subprocess use in sanity test programs.
* Use raw_command instead of run_command with always=True set.
* Add more capture=True usage.
* Don't expose stdin to subprocesses.
* Capture more output. Warn on retry.
* Add more captures.
* Capture coverage cli output.
* Capture windows and network host checks.
* Be explicit about interactive usage.
* Use a shell for non-captured, non-interactive subprocesses.
* Add integration test to assert no TTY.
* Add unit test to assert no TTY.
* Require blocking stdin/stdout/stderr.
* Use subprocess.run in ansible-core sanity tests.
* Remove unused arg.
* Be explicit with subprocess.run check=False.
* Add changelog.
* Use a Python subprocess instead of a shell.
* Use InternalError instead of Exception.
* Require capture argument.
* Check for invalid raw_command arguments.
* Removed pointless communicate=True usage.
* Relocate stdout w/o capture check.
* Use threads instead of a subprocess for IO.
2 years ago
Brian Coca b439e41a91
expand ansible-doc coverage (#74963)
* Expand ansible-doc to tests/filters and fix existing issues

  enable filter/test docs if in single file or companion yaml
  add docs for several filters/tests plugins
  allow .yml companion for docs for other plugins, must be colocated
  verify plugins are valid (not modules, cannot)
  fix 'per collection' filtering
  limit old style deprecation (_ prefix) to builtin/legacy
  start move to pathlib for saner path handling
  moved some funcitons, kept backwards compat shims with deprecation notice

  Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
  Co-authored-by: Felix Fontein <felix@fontein.de>
  Co-authored-by: Sandra McCann <samccann@redhat.com>
2 years ago
Martin Krizek 3980eb8c09
Prevent losing unsafe from lookups (#77609)
* Prevent losing unsafe from lookups

This patch fixes a bug which under certain conditions results in data
returned from lookups not being marked as unsafe.

Each time Templar.do_template is invoked a new AnsibleContext is
created and stored effectively at two places:
1) as an instance variable in templar_obj.cur_context
2) as a local variable called new_context in do_template method of Templar

Due to custom functionality in Ansible's Context that allows for nested
templating it is possible that during resolving variable's value
template/do_template method is called recursively again, again creating
a new context. At that point the problem manifests itself because as
mentioned in 1) above the context is overwriten on the templar object
which means that any subsequent calls to _lookup will use the new
context to mark it as unsafe which is now different to the local
new_context which is used for testing for unsafe property.

The solution to the problem appears to be to restore the original
context inside do_template and also to eliminate the local variable
new_context to prevent problems in the future.

It appears that we don't have a better way of storing the context other
than as some form of global variable and so this appears to be the
"best" solution possible at this point. Hopefully data tagging will be
the solution here.

For more examples see unit and integration tests included in this patch.

Fixes #77535
2 years ago
Matt Clay 26fd5a8c3a Revert "ansible-test - Fix subprocess management. (#77638)"
This reverts commit 62d03c8e75.
2 years ago
Matt Clay 62d03c8e75
ansible-test - Fix subprocess management. (#77638)
* Run code-smell sanity tests in UTF-8 Mode.
* Update subprocess use in sanity test programs.
* Use raw_command instead of run_command with always=True set.
* Add more capture=True usage.
* Don't expose stdin to subprocesses.
* Capture more output. Warn on retry.
* Add more captures.
* Capture coverage cli output.
* Capture windows and network host checks.
* Be explicit about interactive usage.
* Use a shell for non-captured, non-interactive subprocesses.
* Add integration test to assert no TTY.
* Add unit test to assert no TTY.
* Require blocking stdin/stdout/stderr.
* Use subprocess.run in ansible-core sanity tests.
* Remove unused arg.
* Be explicit with subprocess.run check=False.
* Add changelog.
2 years ago
Felix Fontein 841bdb74eb
Replace antsibull with antsibull-docs (#77504) 2 years ago
Sam Doran 1b947eaf92
arg_spec - Return aliases in validation result and update aliases (#77576)
When looking up the `no_log` setting for a parameter that is an alias in
`AnsibleModule._log_invocation()`, the alias value will always be an
empty dictionary since `self.aliases` on the `AnsibleModule` instance is
never updated after initialization. Since the `no_log` setting is on the
canonical parameter not the alias, an incorrect warning is issued if the
parameter matches `PASSWORD_MATCH`.

This PR returns the aliases dictionary as an attribute of the
`ValidationResult` and updates the `aliases` attribute on the
`AnsibleModule` instance.
2 years ago
Matt Clay b960641759 ansible-test - Support multiple coverage versions.
ci_complete
ci_coverage
2 years ago
Jack 4d69c09695
ansible-galaxy collection - ensure dependencies are a dict (#77561)
* fix traceback when installing collection with dependencies set to None
2 years ago
Sloane Hertel 4faa576ee9
Add a test and changelog for non-string host names in yaml inventory files (#77569) 2 years ago
Brian Coca abdd237de7
Yolo (#77554)
* Revert "Revert "Config, ensure templating happens at functions (#77483)""

This reverts commit 94c9106153.

* removed update configdata, which is unused
* removed test for action we don't perform anymore
* removed unused configdata
2 years ago
Matt Clay 191d9a771a ansible-test - Remove more Python 2.7 support. 2 years ago