Commit Graph

12937 Commits (stable-2.19)

Author SHA1 Message Date
Brian Coca 236efefef9
vars loading, show file name instead of vars in error (#86277) (#86281)
* Show file instead of vars on load error

(cherry picked from commit 490795770f34120adc02b08fc24fc50be6ac68a2)
(cherry picked from commit 11a2d02bf2)

* merged

* Update lib/ansible/vars/manager.py



---------


(cherry picked from commit 335db20951)

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
19 hours ago
Felix Fontein 55c6f879f7
runtime-metadata sanity test: ignore pre-release and build identifier (#85198) (#86160)
* Ignore pre-release and build identifier.

* Add tests.

* Improve changelog fragment.



* Extend tests.

---------


(cherry picked from commit 89ba882b08)

Co-authored-by: Matt Clay <matt@mystile.com>
1 week ago
Felix Fontein 281e2e6104
Fix AnsibleModule.human_to_bytes (#85259) (#86174)
* Fix AnsibleModule.human_to_bytes.

* Add unit test.

* Fix wrong example in docstring.

* Forgot tests without keyword.



* Apply review suggestions.

* Add type hints.



---------



(cherry picked from commit 13a7393cfe)

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
Co-authored-by: Matt Clay <matt@mystile.com>
1 week ago
Abhijeet Kasurde 876731e6a1
[stable-2.19] get_url: Fix regex for GNU digest line (#86134) (#86216)
* GNU digest line may contain multiple spaces between
  checksum and filename. Fix regex to handle this situation.

Fixes: #86132
(cherry picked from commit af9009b)

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
1 week ago
Matt Clay 9963ec18e8
[stable-2.19] ansible-test - Improve AZP commit API error handling (#86197) (#86202)
(cherry picked from commit 3d26431e4f)
3 weeks ago
🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) 2657bd7ee5
[stable-2.19] Install `xt_comment` kernel mod @ `iptables` test (#86187) (#86194)
This patch fixes integration test jobs running under RHEL 10.0 that don't have this extension pre-installed.

(cherry picked from commit 69c9fbed26)
3 weeks ago
Matt Clay f5d6ac95c0
[stable-2.19] Fix unit test serialization (#86163) (#86165)
This allows the test to work on pytest 9+

(cherry picked from commit 76f07034b3)
3 weeks ago
Sloane Hertel 1cec559552
Task.resolved_action - fix resolving static actions consistently for callback plugins (#85524) (#85646)
* Resolve static actions when the FQCN is already known or demanded by a callback plugin

shorthand syntax (e.g. "- ping:") is resolved by ModuleArgsParser

action/local_action syntax (e.g. "- action: ping") is resolved on demand

* Emit a warning if a callback plugin accesses the property when it's None. This is expected if action/local_action is a template and a callback plugin uses this value too early (like in v2_playbook_on_task_start) or late (like in v2_runner_on_ok for a task with a loop).

(cherry picked from commit 15e9f51e2d)
1 month ago
Brian Coca eb67bba287
config lookup, fix 'show_origin' and variables (#85356) (#86042)
show_origin and variable sources were broken for base config when 'forked' from plugins
---------
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>

(cherry picked from commit 1cb2932c95)
1 month ago
Jordan Borean b104a05792
[stable-2.19] Remove AddType warning for cleanup (#86029) (#86038)
* Remove AddType warning for cleanup (#86029)

Removes the warning emitted when using Add-Type and the cleanup of temp
files fails due to a file still being in use. The cleanup should be
handled by AnsibleModule on exit giving it more time to wait for any
open file handles to close. The exception is still present if calling
`Add-CSharpType` without an `AnsibleModule` object.

(cherry picked from commit 99bb587906)

* Update win_exec_wrapper integration test to match #86029 (#86052)

* Remove assertion now that there is no warning

(cherry picked from commit df34bf9e70)

---------

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
1 month ago
Martin Krizek 33ee48c590
[stable-2.19] Avoid the ssh-agent exiting before tests end (#85979) (#86007)
There were couple of occurrences where the hard 30 seconds limit on
running ssh-agent was not enough for the test to run and the ssh-agent
was killed resulting in the test failing with "Connection refused". This
change just lets the agent run in the background and kills it
manually after the tests finish.
(cherry picked from commit 05d5b0f168)
1 month ago
sivel / Matt Martz b09dfd6316
[stable-2.19] Fix signal propagation (#85907) (#85984)
(cherry picked from commit 5a9afe4)
1 month ago
David Shrewsbury 37c3e4243a
Fix flakey get_url test (#85953) (#85958)
(cherry picked from commit feda8fc564)
1 month ago
Martin Krizek 4fd2954337
[stable-2.19] import_tasks processing closer to include_tasks (#85877) (#85933)
Fixes #69882
Closes #83853
Fixes #85855
Fixes #85856
(cherry picked from commit c3f87b31d1)
1 month ago
Martin Krizek a49f7a8fe5
[stable-2.19] Don't special case implicit meta tasks when filtering on tags (#85805) (#85938)
* Don't special case implicit meta tasks when filtering on tags

Fixes #85475
(cherry picked from commit 313c6f6b4d)
1 month ago
Felix Fontein 81d883687e
Make sure ansible-doc doesn't crash when scanning collections whose path contains ansible_collections twice (#85361) (#85930)
Ref: https://github.com/ansible/ansible/issues/84909#issuecomment-2767335761



(cherry picked from commit c6d8d206af)

Co-authored-by: s-hertel <19572925+s-hertel@users.noreply.github.com>
Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
1 month ago
Brian Coca 06900bbbac
script inventory plugin correct error message (#85765) (#85868)
type was reflecting 'converted' type, not 'pre conversion' of the data
now message points at specific data keys
add deprecation tests

(cherry picked from commit c87dc6ed7d)
2 months ago
Sloane Hertel 3f7210d00a
Fix ansible-doc -l/-F/--metadata-dump for relative imports in filter/test plugins (#85801) (#85860)
* Add test for sidecar documentation for filter plugin in a subdirectory

Fix ansible-doc --list/--list_files/--metadata-dump for relative imports in nested filter/test plugin files

(cherry picked from commit 5e8815b823)
2 months ago
Jordan Borean 60fe03290f
Windows async - handle trailing junk output (#85820) (#85829)
Add handling for when a PowerShell module emits more than just the
module result JSON. The behaviour reflects the Python async wrapper
where trailing data after the module result will emit a warning.

(cherry picked from commit aad9fbd4f5)
2 months ago
Matt Clay 423032930b
[stable-2.19] Move display internals into _internal (#85889) (#85896)
(cherry picked from commit 58bad71859)
2 months ago
Martin Krizek 764070de69
[stable-2.19] Expose ansible_failed_task in rescue for explicit flush_handlers (#85687) (#85707)
Fixes #85682

(cherry picked from commit c5ddc93767)
3 months ago
Martin Krizek 9aea625f63
[stable-2.19] ternary: evaluate values lazily (#85752) (#85753)
Fixes #85743
(cherry picked from commit 6976e13075)
3 months ago
Matt Clay f2a4eb74ec
[stable-2.19] ansible-test - Update Ansible Core CI auth (#85717) (#85768)
Implement new authentication methods for accessing the Ansible Core CI service.

(cherry picked from commit be9e57366b)
3 months ago
Matt Clay 8d26bbf3f7
[stable-2.19] Fix marker handling in templating (#85690) (#85694)
* allow markers to pass through template lookup
* avoid tripping markers within Jinja generated code

(cherry picked from commit 558676fcdc)

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
4 months ago
Matt Clay a00261b0ec
[stable-2.19] ensure undefined marker access on Jinja getattr->getitem fallback (#85688) (#85691)
(cherry picked from commit 3518d48146)

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
4 months ago
Sloane Hertel 6404fdce45
Fix nested import_tasks when the parent import contains a template (#85599) (#85636)
* Test nested import_tasks when the parent import contains a template

* Fix templating the parent_include.args

(cherry picked from commit 9a6420e1d5)
4 months ago
Matt Davis 2dcd35b692
[stable-2.19] Backward-compatible None handling in template concat and argspec str (#85652) (#85663)
* Backward-compatible None handling in template concat and argspec str (#85652)

* templating coerces None to empty string on multi-node result

* avoid simple cases of embedded `None` in multi-node string concatenated template results ala <=2.18
* single-node template results preserve NoneType

* add None->empty str equivalency to argspec validation

* fix integration tests
* remove conversion error message check from apt_repository test
* remove error message check on `None` value for required str argspec in roles_arg_spec test (now logically-equivalent to empty string)

* explanatory comment for None->empty str coalesce

(cherry picked from commit e3c9908679)

* eliminate None template nodes in _flatten_nodes (#85676)

* defers value or concat choice until Nones are gone
* fixes None -> empty string for TemplateModule cases
* add tests

(cherry picked from commit 5345ac9911)
4 months ago
Abhijeet Kasurde e24bc689a3
[stable-2.19] test: Remove redundant Python 3 condition (#85664) (#85675)
(cherry picked from commit 603dd2d)

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
4 months ago
Matt Clay 3c1e46435b
[stable-2.19] Fix slicing of tuples in templating (#85608) (#85661)
* Fix slicing of tuples in templating

* Improve lazy container test coverage
(cherry picked from commit 00fe38215c)
4 months ago
Matt Clay 0718473815
[stable-2.19] Fix filter plugin result processing (#85653) (#85662)
(cherry picked from commit 76748b8478)
4 months ago
Matt Davis db4973572a
Add temporary module result serialization hook (#85609) (#85621)
* Add temporary module result serialization hook

* Sanity test fix

---------


(cherry picked from commit faf86ca2b3)

Co-authored-by: Matt Clay <matt@mystile.com>
4 months ago
Matt Davis 99d701ccf9
default _ansible_tracebacks_for to [] when not specified (#85427) (#85453)
* eases module unit tests that aren't using our fixture

(cherry picked from commit 6b347bfbf7)
4 months ago
Matt Davis 5a20b991d4
Rewrite exception key on failed_when: false (#85516) (#85517)
* Prevents callback handle_exception from displaying the captured exception when the task is not failed.
* Added tests.


(cherry picked from commit 2fbd7c114e)

Co-authored-by: Matt Clay <matt@mystile.com>
4 months ago
Brian Coca 68378c85cb
plugin config options are now correctly fetched with origin (#85488) (#85525)
* also update callbcacks, since they override these functions
due to backwards compat _options being taken for CLI

(cherry picked from commit 19f9c66004)
4 months ago
Abhijeet Kasurde e8272f1038
[stable-2.19] filter: update integration tests (#84990) (#85540)
(cherry picked from commit 181dbdb)

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
4 months ago
Matt Clay d58c99ddd4
[stable-2.19] Add AnsiballZ debugging support with debugpy (#85476) (#85528)
* Add AnsiballZ debugging support with debugpy

Adds support for debugging AnsiballZ modules with debugpy which is used
by VSCode as its Python debugger DAP. Debugging can either be done
through a manual Debugpy listening server through a launch.json
configuration or through the new ansible-test --dev-debug-on-deman
argument.

* Fix up integration test

* Simplify config option and move mypy ignore

* Use new API if available and fix typo

* Guard the import of debugpy

* Fix sanity import issue

* Minor cosmetic adjustments

* Simplify debugger setup

* ansible-test - Refactor debugging interface

* Add ansible-test debug integration tests

* Fix ansible-test shell when in unsupported dir

---------
(cherry picked from commit 3882366585)

Co-authored-by: Jordan Borean <jborean93@gmail.com>
4 months ago
Martin Krizek 28ca9c09fb
[stable-2.19] dnf/dnf5: address issues discovered in 2.16 yum tests (#83659) (#85607)
Fixes #85554
(cherry picked from commit c0256d6)
4 months ago
Matt Clay a5cc030818
[stable-2.19] ansible-test - Limit bootstrap package install retries (#85544) (#85546)
(cherry picked from commit ee297bb7ca)
4 months ago
Matt Clay f28faa7fbf
[stable-2.19] ansible-test - Fix coverage config (#85555) (#85559)
(cherry picked from commit 35830cb054)
4 months ago
Matt Clay cf6266cc2d
[stable-2.19] Fix paramiko deprecation unit test (#85573) (#85574)
The unit test previously assumed paramiko was installed, and would fail if it was not.

(cherry picked from commit 43a20c9f68)
4 months ago
Matt Clay 72c3a20e1a
[stable-2.19] ansible-test - Use OS packages on FreeBSD 13.5 (#85530) (#85531)
(cherry picked from commit cdb7af094b)
4 months ago
Matt Clay fb09e79b2f
[stable-2.19] Fixed string type in tags fieldattribute (#84655) (#85452)
(cherry picked from commit 8207406306)

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
4 months ago
Matt Clay 483b23ce6d
[stable-2.19] Ensure config env/ini values are tagged (#85404) (#85414)
* Ensure config env/ini values are tagged

Config env and ini values now have origin and trust tags applied.

* Remove unused import
(cherry picked from commit 6ff6339191)
5 months ago
Matt Clay 100b20260a
[stable-2.19] Short-circuit legacy network module prefix->action mapping (#85406) (#85413)
* Short-circuit legacy network module prefix->action mapping

* Modified a non-short-circuit compound conditional in a legacy networking path that attempted to resolve an action for any module name containing `_`. The bug was always present, but the typical presentation (an ImportError) was ignored prior to 2.19.
* The legacy networking path should be deprecated and removed in 2.20- a module could still be run under the wrong action if one with a matching prefix is found.

* unit test fix
(cherry picked from commit d6efb7db8a)

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
5 months ago
Matt Clay d808f11a44 Fix deprecated pylint plugin version parsing (#85402)
(cherry picked from commit 3511299e1e)
5 months ago
Martin Krizek 16999ea4d9 Limit askpass prompts to single attempt (#85364)
* Limit askpass prompts to single attempt

OpenSSH client option NumberOfPasswordPrompts defaults to 3 so in case
an incorrect connection password is provided it is excessively tried 3
times. Not only that but running the `_ssh_askpass` entry point multiple
times (via ssh) results in `json.decoder.JSONDecodeError` as after the
first run the shared memory is zero'd and the subsequent runs end up
calling `json.loads` on empty data.

`json.decoder.JSONDecodeError` does not happen prior to Python 3.13 as
the share memory is unlinked automatically on `.close()` and the
`_ssh_askpass` entry point exits with return code 1 before attempting to
load zero'd memory.

Fixes #85359

* changelog and tests

* Update changelogs/fragments/85359-askpass-incorrect-password-retries.yml

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>

* Update lib/ansible/cli/_ssh_askpass.py

Co-authored-by: Martin Krizek <martin.krizek@gmail.com>

* Avoid race condition in second unlink

---------

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 54ccad9e46)
5 months ago
Patrick Kingston a633311f97 Test multiple inheritance in _utils get_all_subclasses (#85396)
Should bring code coverage in _utils.py to 100%.
Ensures get_all_subclasses won't enter infinite recursion.

(cherry picked from commit fcffd707c6)
5 months ago
Matt Davis a37df1a94a Remove redundant vars FA on PlaybookInclude (#85395)
* The redundant FA declaration was not static, which broke a number of automatic validation behaviors.
* Added tests to assert deferred validation and lack of templating on `import_playbook.vars`.

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 73369f53af)
5 months ago
Matt Davis 9a3288f8c4 unified Marker propagation for all Jinja plugin/call ops (#85391)
* Errors raised in most Jinja operations and plugin invocations are now propagated as Markers, allowing template pipeline to continue execution when a Marker-aware consumer is present.
* Added ability to inspect ExceptionMarkers to Protomatter `dump_object` filter.
* Added tests.

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 29cdba1fee)
5 months ago
Matt Davis ebae950db2 Encryptedstring redact fixes (#85390)
* misc DTFIX/docstring cleanup

* fix EncryptedString redaction, add tests

Co-authored-by: Matt Clay <matt@mystile.com>

* Fix test failures

---------

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 649c9ec443)
5 months ago