* Normalize deprecation records.
* Fix alias deprecations in suboptions.
* Report in which option an alias warning happened for suboptions.
* Add deprecation tests for suboptions.
* Also test deprecation in list of dicts.
* Adjust unit tests for toplevel alias deprecation field name change.
(cherry picked from commit 8a7185c224)
* Ensure we are passing ciphers to all url_get calls. Fixes#79717
* Add clog frag
* Fix tests
(cherry picked from commit 2143bcd)
Co-authored-by: Matt Martz <matt@sivel.net>
* validate-modules: don't fail on invalid YAML
When validate-modules encounters invalid YAML (e.g. in the EXAMPLES
section), it tries to reformat the exception to include the line number
in the Python file instead of the line number of the embedded YAML
document. However, PyYAML doesn't allow modification of the Mark object
(anymore) which leads to a new exception being raised, instead of
reporting the original exception.
As the original exception is not needed in other places anymore, we
don't have to modify it at all and can just compute the right line
number when reporting the error via ansible-test.
Fixes: #75837
* Add test for invalid module doc YAML syntax.
Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit a7111c4dbb)
Co-authored-by: Evgeni Golov <evgeni@golov.de>
Also improve the ansible-test-container integration test:
- Add coverage for the no-probe code path.
- Add work-arounds for centos6 containers (to support backporting).
- Avoid systemd debug when the container doesn't use cgroup.
(cherry picked from commit 04fc98c794)
Co-authored-by: Matt Clay <matt@mystile.com>
* Fix file touch check mode result (#79360) (#79422)
Fixes#79360
(cherry picked from commit 3936b5c471)
* Rename changelog fragment according to PR number
* Enable the `reboot` integration test in CI
Co-Authored-By: Matt Clay <matt@mystile.com>
(cherry picked from commit bb7ad0f0d8)
* [CI] Move running `reboot` integration test to group 2
PR #79289, follow-up for #78402.
It was breaking the integration-aliases sanity test, but only
became apparent post-merge. This patch fixes that.
(cherry picked from commit 26a4775611)
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
* background threads writing to stdout/stderr can cause children to deadlock if a thread in the parent holds the internal lock on the BufferedWriter wrapper
* prevent writes to std handles during fork by monkeypatching stdout/stderr during display startup to require a mutex lock with fork(); this ensures no background threads can hold the lock during a fork operation
* add integration test that fails reliably on Linux without this fix
(cherry picked from commit 1424484be0)
This should prevent color codes from interfering with string matches.
(cherry picked from commit 31f9d60b8d)
Co-authored-by: Matt Clay <matt@mystile.com>
* ansible-galaxy install - fix unnecessary api check when installing a role from git repo (#79090)
* delay server api evaluation until a GalaxyRole needs to make an api call for info, list, and install
(cherry picked from commit cb2e434dd2)
* Fix isinstance check (#79159)
Use GalaxyAPI for isinstance check instead of RoleDistributionServer, since the latter is defined in __main__ sometimes (when running integration tests or ansible-galaxy from source) and importing from ansible.cli.galaxy won't reference the same object.
(cherry picked from commit 89d682464b)
* Log `runme.sh` execution in integration tests (#79263)
* Log `runme.sh` execution in integration tests
This patch adds `set -x` where it's missing in the integration tests.
It also enables `pipefail` in `runme.sh` scripts that use pipes.
* Add a change note for PR #79263
(cherry picked from commit 6674c43edd)
* Delete a bad PR #79263 change note
(cherry picked from commit 9cfb3f73e8)
The latest versions of `git` include a fix for CVE-2022-39253. The fix blocks the file protocol by default.
See: 45c9f05c44/Documentation/RelNotes/2.30.6.txt
(cherry picked from commit 4202acb41b)
Co-authored-by: Matt Clay <matt@mystile.com>
* [stable-2.14] Ensure that we do not squash keywords in validate (#79049)
* Ensure that we do not squash keywords in validate. Fixes#79021
* become_user: nobody should only apply to the test tasks, not the setup_test_user role
* Update how become_user is specified
* Add test to ensure keyword inheritance is working for become
* Add clog frag
* Cache fattributes to prevent re-calculation
* ci_complete
* Remove unnecessary getattr.
(cherry picked from commit 420564c5bc)
Co-authored-by: Matt Martz <matt@sivel.net>
* Remove unneeded merge conflict changes
* 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
(cherry picked from commit 9650ddb11c)
* fixes to FA inheritance (#78990)
finalized applies to all field attributes
fix getting parent value
also remove unused/needed extend/prepend signature
moar testing
(cherry picked from commit ff6e4da36a)
* setup role needs it's own info
* 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>
(cherry picked from commit 6d0aeac1e1)
* 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>
* Rename changelog fragment for fix known hosts changed status cherry pick
* Rename changelog according to new PR number
Co-authored-by: Matt Martz <matt@sivel.net>
- 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).
(cherry picked from commit d3d7785472)
Co-authored-by: Matt Clay <matt@mystile.com>
* 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>
* 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
* 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
* 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>