55257 Commits

Author SHA1 Message Date
Matt Davis
2fbd7c114e Rewrite exception key on failed_when: false (#85516)
* Prevents callback handle_exception from displaying the captured exception when the task is not failed.
* Added tests.

Co-authored-by: Matt Clay <matt@mystile.com>
2025-07-22 17:39:54 +00:00
Patrick Kingston
737c68ace3 Add install_python_debian parameter to deb822_repository (#85487)
* Add python3-debian dependency installation in module

* Add tests to exercise automatic dependency installation

* Fix broken tests to include new module parameter

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-07-22 11:48:33 -04:00
Abhijeet Kasurde
d2be8684b3 Remove deprecated py3compat.environ call (#85501)
Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-07-22 11:27:50 -04:00
Abhijeet Kasurde
a2427e45df docs: use correct URL in docs (#85491)
* wait_for: use correct URL in docs

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-07-22 11:18:38 -04:00
Abhijeet Kasurde
19c7ec6ed2 Distribution: Added UCS in Debian OS Family (#85496)
* Identify Univention Corporate Server as Debian OS Family.

Fixes: #85490

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-07-22 11:16:52 -04:00
Brian Coca
8c3d23513f removed removed acceleration keywords (#85507) 2025-07-18 14:15:19 -04:00
Jordan Borean
3882366585 Add AnsiballZ debugging support with debugpy (#85476)
* 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

---------

Co-authored-by: Matt Clay <matt@mystile.com>
2025-07-18 14:51:40 +10:00
Abhijeet Kasurde
eb5e57a8f0 six: bump version from 1.16 to 1.17 (#85478)
Fixes: #85408

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2025-07-16 04:21:17 +00:00
Matt Martz
ee96f8e912 Use the API task URI directly for polling collection imports (#85419) 2025-07-15 13:50:56 -04:00
Brian Coca
319dca2ea8 meta: clear_host_errors, clarify what this applies to (#85463)
* meta: clear_host_errors, clarify what this applies to

It clears host for selection, but does not change state in the current iterator.

* also update example
2025-07-10 15:05:22 -04:00
Sloane Hertel
da6735160d Fix passing callbacks the delegated connection, host, port, and user (#85397)
Fix ssh plugin host variables. Variable names should conform to Python variable naming rules.
, and not contain characters like "[" or "]".

Update unit test
2025-07-08 10:12:42 -04:00
Martin Krizek
c24b187f88 dnf/dnf5: remove deprecated install_repoquery option (#85440)
https://github.com/ansible/ansible/issues/85410
2025-07-08 10:58:19 +02:00
Martin Krizek
e4135b6f19 yum_repository: remove deprecated keepcache option (#85441) 2025-07-08 10:57:35 +02:00
Abhijeet Kasurde
8207406306 Fixed string type in tags fieldattribute (#84655)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-07-07 11:44:19 -07:00
Abhijeet Kasurde
34f2f39abe json filter: update docs (#84989)
Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
Co-authored-by: Matt Clay <matt@mystile.com>
2025-07-07 17:06:08 +00:00
Matt Clay
d19366331f ansible-test - Remove obsolete network provisioning (#85433) 2025-07-03 16:25:33 -07:00
Matt Clay
35252fd96c Drop incidental network tests from CI (#85425) 2025-07-03 14:12:38 -07:00
Matt Davis
6b347bfbf7 default _ansible_tracebacks_for to [] when not specified (#85427)
* eases module unit tests that aren't using our fixture
2025-07-03 20:21:28 +00:00
Patrick Kingston
a032f96222 Expand expect module test suite (#85422)
* Test expect module for missing pexpect

* Test expect module for incorrect timeout type

* Test expect module for out of date pexpect failures

* Test pexpect.ExceptionPexpect

Also fixed task naming to be inline with the rest of the file.

* Change pexpect management to venv

* Normalize b_out to b'' when falsy for consistent handling

* Move test venv from /tmp/ to output_dir

* Update tests according to corrections

* Remove break_system_packages when installing pexpect 3.3

* Remove unnecessary if statement

pexpect.run(...) shouldn't ever return None, so it's safe
to remove the check entirely. Maintains 100% coverage
2025-07-03 12:59:51 -07:00
Abhijeet Kasurde
e162eda1e6 apt: Mark dependencies as auto (#85170)
* Mark dependent packages as auto which are installed as part of
  deb file installation

Fixes: #78123

Co-authored-by: Matt Clay <matt@mystile.com>
Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-07-03 16:25:11 +00:00
Thomas Sjögren
205ca648bf ansible-doc: print where the description is missing (#85320)
* ansible-doc: print where the description is missing

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2025-07-03 11:26:09 -04:00
Abhijeet Kasurde
557733abb1 yaml filter: update docs (#85261)
Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-07-03 15:02:17 +00:00
Xiao Wenyang
a4e3575077 stat module, add option to return SELinux Context
Added get_selinux_context option
2025-07-02 10:27:54 -04:00
Matt Clay
a1d25cca00 ansible-test - Upgrade coverage to 7.9.1 (#85411) 2025-06-30 17:41:10 -07:00
Matt Clay
6ff6339191 Ensure config env/ini values are tagged (#85404)
* Ensure config env/ini values are tagged

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

* Remove unused import
2025-06-30 16:33:37 -07:00
Matt Davis
d6efb7db8a Short-circuit legacy network module prefix->action mapping (#85406)
* 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
2025-06-30 16:33:28 -07:00
Matt Clay
ac8c66d431 Bump devel version to 2.20.0.dev0 (#85409) 2025-06-30 23:31:20 +00:00
Matt Clay
3511299e1e Fix deprecated pylint plugin version parsing (#85402) 2025-06-30 14:18:49 -07:00
Sloane Hertel
7216e04139 Remove deprecation warning caused by automatic role argument spec validation (#85401) 2025-06-30 12:19:57 -07:00
Martin Krizek
54ccad9e46 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>
2025-06-28 02:01:33 +00:00
Patrick Kingston
fcffd707c6 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.
2025-06-26 17:14:20 -07:00
Matt Davis
73369f53af 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>
2025-06-26 11:34:29 -07:00
Matt Davis
29cdba1fee 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>
2025-06-26 01:17:18 +00:00
Matt Davis
649c9ec443 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>
2025-06-26 00:42:23 +00:00
Matt Davis
db819d2514 ensure transform_to_native_types converts keys (#85389)
* added basic key visitor support to variable visitor (off by default)
* transform_to_native_types enables new key visit/conversion
* add test

Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-25 19:43:57 +00:00
Matt Clay
4a03ccbd41 Use codecov-cli for uploads (#85386)
ci_coverage
ci_complete
2025-06-25 10:04:15 -07:00
liviozanol
66a7cfe77d Docs: fix small typo (#85388) 2025-06-25 08:43:07 -04:00
Matt Davis
11f5563895 Jinja sandbox refinement (#85385)
* DTFIX recategorize

* fix ansible-console generated task dict

* use non-deprecated task shape

* switch Jinja from ImmutableSandboxedEnvironment to SandboxedEnvironment

* Restore ability to call collection mutation methods.
* Restore ability to directly call integer bitwise operator methods.
* Adjust tests.

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

---------

Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-25 03:37:21 +00:00
Patrick Kingston
e7c7df7074 Add test coverage to ansiballz builder source mapping (#85382)
Should bring code coverage in _builder.py to 100%.
2025-06-24 13:41:06 -07:00
Matt Davis
547c64f326 deprecate esoteric/undocumented playbook syntaxes (#85378)
Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-24 17:00:37 +00:00
Matt Davis
1f8937b57e restore playbook import DS rewrite (#85379)
* add tests for FQ "action" aliases
* add validation for multiple directives

Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-24 01:36:50 +00:00
Matt Davis
3c52b14c9e deprecate invalid variable names in inventory (#85377)
* deprecate invalid variable names in inventory

* was previously a hard error for `Host`
* added missing check to `Group`
* swapped blanket Python keyword prohibition with Jinja singleton and `not` check

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

* fix invalid variable name test

---------

Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-23 16:55:53 -07:00
Nils Brinkmann
578d25f286 Add type annotations to the Role.__init__() method
PR #85346

This patch adds type-checking to the `Role.__init__()` method. 

Context: https://github.com/ansible/ansible/pull/85249#issuecomment-2956115486

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
Co-authored-by: Sviatoslav Sydorenko <webknjaz@redhat.com>
Co-authored-by: Nils Brinkmann <nils.brinkmann@rheinmetall.com>
2025-06-23 16:31:59 +00:00
Martin Krizek
ef9d92b31d Test both original and latest dnf versions (#85342)
Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-19 08:19:32 +02:00
Matt Davis
dde10a9afb import_playbook validation cleanup (#85358)
* use declarative FA validation
* deleted redundant/broken imperative validation
* added test case to ensure templating

Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-19 00:38:23 +00:00
Matt Clay
3354d0d4e2 Add ticket stub for minor changes (#85350) 2025-06-18 17:05:23 -07:00
Matt Davis
fa9f286096 display wrap/format arg cleanup (#85352)
Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-18 14:50:45 -07:00
Martin Krizek
34abc83822 Remove Python 2 mentions (#85353) 2025-06-18 19:14:16 +02:00
Matt Davis
46abcfcc82 feature-flag experimental module metadata (#85351)
* added ansible-test integration env/set directive for aliases
* applied to module-serialization-profiles test to enable feature flag

Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-17 23:15:55 +00:00
Sloane Hertel
8e9f5fb9d5 password lookup - re-attempt acquiring lock file regardless of locale (#85318)
* Fix handling FileExistsError, instead of only handling OSError when the human-readable error message is "File exists".

Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-17 16:37:25 -04:00