Commit graph

4613 commits

Author SHA1 Message Date
Sloane Hertel
cb2ecda514
Remove support for resolvelib < 0.8.0 (#85936)
* Remove support for resolvelib < 0.8.0

Remove code handling differences between resolvelib 0.5.3 and 0.8.0

Drop some versions from the test to reduce the time it takes to run

Co-authored-by: Sviatoslav Sydorenko <wk@sydorenko.org.ua>

* Remove type annotation

---------

Co-authored-by: Sviatoslav Sydorenko <wk@sydorenko.org.ua>
2025-10-01 14:33:21 -07:00
Martin Krizek
313c6f6b4d
Don't special case implicit meta tasks when filtering on tags (#85805)
* Don't special case implicit meta tasks when filtering on tags

Fixes #85475
2025-10-01 17:44:53 +00:00
Abhijeet Kasurde
6bee84318d
known_hosts: return rc and stderr in fail_json (#85871)
* When ssh-keygen fails, return rc and stderr in fail_json
  in order to help debugging.

Fixes: #85850

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-10-01 16:07:29 +00:00
Martin Krizek
c3f87b31d1
import_tasks processing closer to include_tasks (#85877)
Fixes #69882
Closes #83853
Fixes #85855
Fixes #85856
2025-10-01 09:56:14 +02:00
Felix Fontein
c6d8d206af
Make sure ansible-doc doesn't crash when scanning collections whose path contains ansible_collections twice (#85361)
Ref: https://github.com/ansible/ansible/issues/84909#issuecomment-2767335761

Co-authored-by: s-hertel <19572925+s-hertel@users.noreply.github.com>
Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
2025-09-30 10:08:43 -04:00
Matt Clay
58bad71859
Move display internals into _internal (#85889) 2025-09-22 16:07:10 -07:00
Chris Meyers
79ddee15a0
Prevent IO capture hang/loss in basic.run_command (#85869)
* Prevent run_command output truncation or hang

In cases when the selector used to monitor stdout/stderr activates without
data ready to read (a rare but normal condition), a read from a non-blocking
FD can return `None`, which was being conflated with an empty read (EOF)
condition. This caused the selector to be unregistered prematurely,
sometimes resulting in truncated output or hangs. `None` read results
are now excluded from EOF conditions.

* add changelog

---------

Co-authored-by: Matt Davis <nitzmahone@redhat.com>
2025-09-19 16:56:21 +00:00
Sloane Hertel
27a56a34df
Add feature preview play argument spec validation (#85763)
* Add new play keyword validate_argspec

Set to True to use the play name as the argument spec identifier. A play name is required (i.e. a host pattern is not supported as an argument spec name).

Alternatively, set to a specific argument spec name.

A valid argument spec for the play is required. Example:

# playbook.meta.yml
argument_specs:
  name of the play:
    options: {}

* Play argument spec validation runs after fact gathering

Play keywords like tags are inherited and work similarly to fact gathering
2025-09-18 15:13:07 -04:00
Brian Coca
c87dc6ed7d
script inventory plugin correct error message (#85765)
type was reflecting 'converted' type, not 'pre conversion' of the data
now message points at specific data keys
add deprecation tests
2025-09-17 09:59:37 -04:00
Sloane Hertel
5e8815b823
Fix ansible-doc -l/-F/--metadata-dump for relative imports in filter/test plugins (#85801)
* 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
2025-09-15 18:15:55 -04:00
Sloane Hertel
ced362a50d
ansible-galaxy - remove deprecated v2 API (#85830)
* ansible-galaxy - remove deprecated v2 API

Update unit tests exercising the v2 Galaxy API

Remove v2 API integration tests

* Remove internal test configuration for servers which support API v2 and v3

* Update and simplify verify tests by using the configured server list
2025-09-15 17:29:12 -04:00
Ben Buchwald
e30da51731
Fix jsonfile cache on WSL (#85816)
On WSL, `os.rename` can't correctly move a file while a handle to that file is still open. It remains half-moved where neither the source or destination seem to exist (according to `os.path.exists`). However the move seems to complete correctly when the open handle is closed.

In `BaseFileCacheModule`, when writing a cache file, a temporary file is created with `mkstemp` that returns an open file descriptor and a filename. Once the cache is written to that file, it is renamed to the correct file name with `os.rename` and then its permissions set with `os.chmod`. On WSL the `os.chmod` fails because it doesn't think the file exists yet because the file descriptor returned by `mkstemp` is still open. This PR fixes this by closing that file descriptor before renaming.

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-09-11 23:09:59 +00:00
Matt Clay
9966e01f81
ansible-test - Update containers (#85842) 2025-09-10 17:32:20 -07:00
Ketan Kelkar
18691ec83f
Replace module - update string comparison method from bytes to unicode (#85785) 2025-09-10 17:31:22 -05:00
Matt Clay
d2940880ed
ansible-test - Upgrade coverage to 7.10.6 (#85831) 2025-09-09 09:59:36 -07:00
Zdeněk Vydra
60511c2a08
Fix uri form-multipart to not overwrite filename to allow retries (#85010) 2025-09-09 16:09:28 +00:00
Jordan Borean
aad9fbd4f5
Windows async - handle trailing junk output (#85820)
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.
2025-09-09 04:30:38 +10:00
Abhijeet Kasurde
1cd4369815
fetch_file: add ca_path and cookies parameters (#85187)
* Added ca_path and cookies parameter arguments to fetch_file method
  to specify CA path and Cookies to fetch file from URL. These parameters
  are already supported by fetch_url.

Fixes: #85172

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-09-08 14:44:17 +00:00
Abhijeet Kasurde
975f60ebf9
encrypt: Remove deprecated passlib_or_crypt API (#85506)
Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-09-05 22:19:53 +00:00
Abhijeet Kasurde
a805356358
include_vars: Code cleanup and integration tests (#85292)
* Updated docs
* Removed stale code
* Added integration tests for better coverage

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-09-05 20:18:26 +00:00
Matt Clay
a25fd1021a
ansible-test - Fix traceback on missing tmp dir (#85814) 2025-09-05 18:15:43 +00:00
Jordan Borean
f29d432c69
powershell - remove quoting logic (#85781)
Attempts to simplify the PowerShell code and special edge cases that
removes quotes from a value like a src or destination path on Windows
hosts. This should not be needed as paths should not be quoted when it
comes to this section of the code.

ci_complete
2025-09-05 11:21:58 +10:00
Jordan Borean
a345a404e0
shell - deprecates the wrap_for_exec API (#85782)
Deprecates the function `wrap_for_exec` on shell plugins. This is to
simplify the API and remove unecessary components that should live
elsewhere or have a better and more flexible API.
2025-09-05 11:21:18 +10:00
Jordan Borean
3582997698
Remove deprecated vars plugin fallback (#85809)
* Remove deprecated vars plugin fallback

Removes the vars plugin `get_host_vars` and `get_group_vars` fallback
which was deprecated.

* Remove integration tests for removed feature
2025-09-05 01:09:02 +00:00
Jordan Borean
94c78cb38f
Removed deprecated DEFAULT_TRANSPORT smart option (#85810)
* Removed deprecated DEFAULT_TRANSPORT smart option

Removes the logic for handling `DEFAULT_TRANSPORT` set to `smart`.

* Remove unused import
2025-09-05 10:58:04 +10:00
Matt Martz
c59db5349e
Add typing to to_text and to_bytes, improve typing and type juggling in DataLoader (#85746) 2025-09-04 18:57:35 -05:00
Felix Fontein
4209d714db
validate-modules and return fragments: fix bug in markup check, fix bug in missing doc fragment check, add tests (#85638)
* Prevent crashing on invalid structure.

* Also process return doc fragments.

* Fix handling of missing doc fragments.
2025-09-03 21:52:22 +00:00
Felix Fontein
4c27ccf8f4
default callback: allow to configure indentation (#85497)
* Comment on PyYAML's behavior if indentation is set to 1, or to 10+.
2025-09-03 21:17:50 +00:00
Abhijeet Kasurde
d93f63ecfb
apt_repository: Use correct debug method (#85786)
* Use self.module.debug method instead of non-existent
  self.debug method

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-09-02 16:09:32 -07:00
Sloane Hertel
0ed37ca899
setup - add logical volume facts scoped by volume group (#85705)
Add an 'lvs' key to each value in ansible_facts['vgs'] to support extracting all logical volume facts.

Add note to consider deprecating ansible_facts['lvs'] in a future release since it is misleading if any volume groups have identical logical volume names.

Fixes #85632
2025-09-02 13:30:03 -04:00
Abhijeet Kasurde
7b1644e0b3
dnf: Check if installroot is directory or not (#85748)
* dnf: Check if installroot is directory or not

* dnf library creates installroot if it is missing.
  check if installroot is directory or not.

Fixes: #85680

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-09-02 11:11:30 -04:00
Matt Clay
be9e57366b
ansible-test - Update Ansible Core CI auth (#85717)
Implement new authentication methods for accessing the Ansible Core CI service.
2025-08-29 15:22:09 -07:00
Matt Clay
e8a3be9de5
ansible-test - Update sanity test and coverage requirements (#85761)
* ansible-test - Update sanity test requirements

* ansible-test - Update coverage to 7.10.5
2025-08-28 17:50:05 +00:00
Martin Krizek
6976e13075
ternary: evaluate values lazily (#85752)
Fixes #85743
2025-08-28 09:11:09 +02:00
Martin Krizek
3ec07418aa
ansible-doc: remove displaying role attributes (#85725) 2025-08-27 08:05:11 +02:00
Martin Krizek
5e78bc8eda
vault/unvault filters: remove deprecated vaultid parameter (#85744) 2025-08-26 15:11:57 +02:00
Brian Coca
534b8c225a
vars deprecation (#85673)
internal 'vars' dict cache has not been used for long time, but kept since we could not deprecate and some users had found it
2025-08-22 18:31:46 -04:00
Brian Coca
931c923e0e
Deprecate defaulting to inject (#85323)
INJECT_FACTS_AS_VARS config deprecate default of true
2025-08-22 15:54:45 -04:00
Brian Coca
75ad1f8d6a
tags warn wwhen using reserved tags (#85631) 2025-08-22 15:35:09 -04:00
Brian Coca
8b6446f2d5
Deprecate hash_params (#85630)
we stopped using it long ago, no plugin should be using it either, but JIC deprecate

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-08-21 16:56:16 -04:00
Martin Krizek
c5ddc93767
Expose ansible_failed_task in rescue for explicit flush_handlers (#85687)
Fixes #85682
2025-08-19 11:29:50 -04:00
Matt Davis
b1fc98c8ad
Include result origin in broken conditional message instead of result (#85695)
Co-authored-by: Matt Clay <matt@mystile.com>
2025-08-18 22:35:39 +00:00
Matt Davis
558676fcdc
Fix marker handling in templating (#85690)
* allow markers to pass through template lookup
* avoid tripping markers within Jinja generated code

Co-authored-by: Matt Clay <matt@mystile.com>
2025-08-18 13:04:23 -07:00
Matt Davis
3518d48146
ensure undefined marker access on Jinja getattr->getitem fallback (#85688)
Co-authored-by: Matt Clay <matt@mystile.com>
2025-08-18 11:42:15 -07:00
Matt Davis
0467e1eaa9
add known_issues for Jinja set/with (#85677) 2025-08-15 22:37:40 +00:00
Ketan Kelkar
18289c403d
Blockinfile - Add new module option - 'encoding' (#85291)
Signed-off-by: Ketan Kelkar <ktnklkr@gmail.com>
Signed-off-by: Yogesh Rana <Yogesh.Rana@ibm.com>
Co-authored-by: Yogesh Rana <Yogesh.Rana@ibm.com>
Co-authored-by: Yogesh Rana <36674300+yrana17@users.noreply.github.com>
Co-authored-by: Matt Martz <matt@sivel.net>
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-08-14 16:16:53 -05:00
Matt Davis
e3c9908679
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
2025-08-13 22:05:01 +00:00
Matt Clay
76748b8478
Fix filter plugin result processing (#85653) 2025-08-13 14:20:11 -07:00
Matt Clay
00fe38215c
Fix slicing of tuples in templating (#85608)
* Fix slicing of tuples in templating

* Improve lazy container test coverage
2025-08-12 23:57:19 +00:00
Ketan Kelkar
4cb5fe44b6
Lineinfile - Add new module option - 'encoding' (#84999)
Signed-off-by: Ketan Kelkar <ktnklkr@gmail.com>
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Matt Martz <matt@sivel.net>
2025-08-12 15:37:33 -05:00
Abhijeet Kasurde
90f62f3fdf
regex: validate input before processing (#85629)
* Validated user input for match_type before processing
* added new match_type 'fullmatch'

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-08-12 08:01:26 -07:00
Felix Fontein
45d62a726c
ansible-doc: show 'notes', 'seealso', and top-level 'version_added' for role entrypoints (#81796)
* Show 'notes', 'seealso', 'requirements', and top-level 'version_added' for role entrypoints.

Co-authored-by: Matt Clay <matt@mystile.com>
2025-08-11 23:07:32 +00:00
Sloane Hertel
15e9f51e2d
Task.resolved_action - fix resolving static actions consistently for callback plugins (#85524)
* 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).
2025-08-11 15:04:54 -04:00
Sloane Hertel
9a6420e1d5
Fix nested import_tasks when the parent import contains a template (#85599)
* Test nested import_tasks when the parent import contains a template

* Fix templating the parent_include.args
2025-08-08 15:51:00 -04:00
Martin Krizek
4c04b8c7c3
IncludedFile: store _from args for proper deduplication (#85628)
* IncludedFile: store _from args for proper deduplication

Fixes #66497

Co-authored-by: Matt Martz <matt@sivel.net>
2025-08-07 15:52:47 -04:00
Abhijeet Kasurde
9ed7164ed6
service_facts: Handle KeyError while processing service name (#85572)
* service_facts: Handle KeyError while processing service name

As a part of follow up review,

* Handle KeyError with exception handling
* Warn user about the missing service name in the given service details

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-08-07 15:16:52 -04:00
Matt Davis
faf86ca2b3
Add temporary module result serialization hook (#85609)
* Add temporary module result serialization hook

* Sanity test fix

---------

Co-authored-by: Matt Clay <matt@mystile.com>
2025-08-04 16:43:59 -07:00
Brian Coca
ca5871f256
add fragments to return (#72635)
* ansible-doc add ability to use doc_fragments for RETURN


---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2025-08-04 16:58:44 -04:00
Sloane Hertel
945516c209
ansible-galaxy - remove internal path when using AnsibleCollectionConfig.collection_paths (#85596)
* remove internal collections earlier to ignore consistently for different sub-commands

* remove internal collection handling from the dependency resolver

* add a test to ensure ansible._protomatter is not in the output of ansible-galaxy collection list

* fix existing test to ensure an error is given if no valid collection path is configured

* changelog
2025-08-04 13:45:26 -04:00
Abhijeet Kasurde
97b2242b78
wrapt: Bump version from 1.15.0 to 1.17.2 (#85500)
Fixes: #85407

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-07-31 11:35:16 -04:00
Patrick Kingston
817f0af239
pip - fix reporting changed for empty venv creation (#85556)
* Add correct empty venv creation handling

Makes the module exit with changed=True
when an empty venv is created with correct
module output

* Add tests for creating an empty venv
2025-07-31 10:11:04 -04:00
Matt Clay
f2612fbe3a
Drop Python 3.11 controller support (#85590) 2025-07-30 16:39:38 -07:00
Brian Coca
5faa256178
ansible-galaxy, dont display internals (#85571)
Also note broken test for invalid collection paths

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2025-07-30 15:08:12 +00:00
Martin Krizek
ac5eb232e9
Do not re-add tags on blocks from within import_tasks (#85471) 2025-07-29 11:11:23 -05:00
Matt Clay
5fbce46dcf
ansible-test - Update pinned sanity test requirements (#85577) 2025-07-29 01:19:34 +00:00
Matt Clay
6b2b665ef7
Add support for Python 3.14 and drop Python 3.8 (#85576) 2025-07-28 16:16:14 -07:00
Matt Clay
9b266da14f
ansible-test - Update containers and remotes (#85562) 2025-07-26 01:43:40 +00:00
Matt Clay
58c9f48029
ansible-test - Replace FreeBSD 14.2 with 14.3 (#85561)
* ansible-test - Replace FreeBSD 14.2 with 14.3

* Fix CA bundle search priority
2025-07-25 18:09:37 -07:00
Matt Clay
2e71e5aeb9
ansible-test - Replace RHEL 9.5 with 9.6 (#85558) 2025-07-25 22:11:24 +00:00
Matt Clay
35830cb054
ansible-test - Fix coverage config (#85555) 2025-07-25 14:39:03 -07:00
Abhijeet Kasurde
ea238c9eb5
tqm: Use correct warning methods (#85434)
* Use display.error_as_warning instead of self.warning
* Use display.error_as_warning instead of display.warning_as_error.

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-07-24 21:35:30 -07:00
Matt Clay
ee297bb7ca
ansible-test - Limit bootstrap package install retries (#85544) 2025-07-24 21:09:30 -07:00
Matt Clay
853752a3eb
ansible-test - Upgrade to coverage 7.10.0 (#85541) 2025-07-24 21:09:06 -07:00
Abhijeet Kasurde
181dbdbf27
filter: update integration tests (#84990)
Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-07-24 15:37:15 +00:00
Matt Clay
cdb7af094b
ansible-test - Use OS packages on FreeBSD 13.5 (#85530) 2025-07-23 21:42:45 +00:00
Brian Coca
19f9c66004
plugin config options are now correctly fetched with origin (#85488)
* also update callbcacks, since they override these functions
due to backwards compat _options being taken for CLI
2025-07-23 11:49:14 -04:00
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
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
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
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
Matt Clay
d19366331f
ansible-test - Remove obsolete network provisioning (#85433) 2025-07-03 16:25:33 -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
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
ac8c66d431
Bump devel version to 2.20.0.dev0 (#85409) 2025-06-30 23:31:20 +00: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
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
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
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
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
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
Matt Clay
d922398c4d
Show context for reserved variable warnings (#85324)
* Show context for reserved variable warnings

* Update integration test

* Use var origin not value origin

* Use a list

* Ensure tagged varname is used
2025-06-17 13:21:27 -07:00
Matt Clay
83fcaeaa8b
Spelling fixes (#85345)
A few grammar fixes too.
2025-06-17 05:26:36 +00:00
Matt Davis
eec57ec396
Misc callback fixes/cleanup (#85344)
* Misc callback fixes/cleanup

* Fix v1 callback method dispatch, fully deprecate v1 methods, add missing tests.
* Clean up callback plugin init/setup code, remove redundancies, improve error messaging.
* Remove unused callback method definitions from base class.

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

* switch callback bypass to instance-level from class-level

* preserves any instance-level method magic that implementations were using

* add missing handler dispatch entry

* add tests to ensure all methods are covered

---------

Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-16 20:03:06 -07:00
Matt Clay
093ac8df2d
ansible-test - Fix relative import resolution (#85328) 2025-06-14 16:11:03 +00:00
Abhijeet Kasurde
cace19f365
apt: Consider timeout while invoking apt-get command (#85219)
* apt: Consider timeout while invoking apt-get command

* Apply timeout specified by user to apt-get command
  using '-o DPkg::Lock::Timeout=' syntax

Fixes: #78658

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-06-12 17:37:21 -05:00
Matt Clay
7ef13cb29e
ansible-test - Add remote debugging support (#85317) 2025-06-12 18:57:36 +00:00
Brian Coca
02c21742a3
Assemble add check mode (#85094)
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-06-12 16:13:15 +00:00
Brian Coca
7e495f4b20
ansible-doc display docs for modules w/o ext (#85299)
Fixed case in which listing modules for docs failed to get sidecar

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-06-11 14:20:05 -07:00
Sloane Hertel
d3977ebc88
fix handler include_tasks templating (#85015)
* Add test for a handler including tasks from a variable filename

* Add FieldAttributeBase attribute to indicate if the object should be post validated

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
2025-06-11 11:27:00 -04:00
Matt Davis
1d1bbe3424
Fix post-fork deadlock from early Python writers like pydevd (#85296) 2025-06-11 01:08:48 +00:00
Matt Clay
45dd2c0647
AnsiballZ refactoring and remote debug support (#85289) 2025-06-10 14:11:19 -07:00
David Shrewsbury
aa8d58a174
get_url - check for incomplete data read (#85164) 2025-06-10 15:17:22 -05:00
Martin Krizek
532edf4c35
Fix templating tags on plays and roles (#82314)
Fixes #69903

ci_complete
2025-06-10 20:49:05 +02:00
Matt Davis
2bed98bd20
fix Marker handling on Jinja macro invocations (#85280)
* always allow Marker args to pass through
* always disable pre-emptive trip-on-retrieval for Macro JinjaCallContext
* add macro-callable template expression result test cases

Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-06 13:26:45 -07:00
Matt Davis
9f0a8075e3
Prevent template lookup and action from masking ansible_managed value (#85075)
* deprecate DEFAULT_MANAGED_STR and prevent masking of ansible_managed var

* adjust public API behavior

* restore backward-compatible behavior on existing public API
2025-06-05 17:21:48 -07:00
Matt Davis
2b7204527b
Restore 2.18 vault tag YAML dump behavior (#85275)
* Doing conditional redaction/formatting needs other bits that aren't ready for 2.19.

Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-05 19:21:46 +00:00
Martin Krizek
d7c4d0119f
Deprecate ShellModule.checksum() (#85216)
The methods have not been used, updated or tested since
b9d0662faf.
2025-06-03 11:14:55 -04:00
Jordan Borean
8f2622c39f
doc - Dynamically document jinja builtins (#85215)
* doc - Dynamically document jinja builtins

This change has `ansible-doc` dynamically generate the documentation for
any Jinja builtin filter and test plugins. These dynamic stubs will
point to the official Jinja documentation pages for more information.

* Fix sanity issues

* Add tests

* Update Jinja builtin doc gen

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

---------

Co-authored-by: Matt Davis <nitzmahone@redhat.com>
Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-02 13:23:30 -07:00
Martin Krizek
3505572470
Deprecate ansible.compat.importlib_resources (#85226)
Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-02 09:51:03 +02:00
Martin Krizek
487d699226
Deprecate module_utils.common.collections.count (#85233)
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-02 09:49:42 +02:00
Jordan Borean
b4741fc495
Exclude ansible._protomatter from ansible-doc output by default (#85115)
* Exclude ansible._protomatter from ansible-doc output by default

* Added changelog
2025-05-30 15:12:45 -07:00
Matt Davis
0ee1c36779
local connection always passes str to Popen (#85239) 2025-05-30 14:39:45 -07:00
Matt Davis
2a24633964
Misc ssh agent fixes (#85238)
* Misc ssh-agent fixes

* Replace manual SIGALRM handling with new alarm_timeout context manager
* Misc error handling fixes to ssh-agent startup
* Add SSH_AGENT_EXECUTABLE config to ease failure mode testing
* 100% test coverage on agent startup failure code

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

* make SSH Agent support internal

---------

Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-30 13:38:59 -07:00
Matt Clay
eafe5fc739
Add missing warning methods and args (#85225) 2025-05-30 11:36:21 -07:00
Matt Davis
cbcefc53a3
Clean up TE error handling, wrap sigalrm handler (#85232)
* Clean up TE error handling, wrap sigalrm handler

* Preserve error detail on AnsibleAction and Connection exceptions.
* Remove multiple layers of unreachable or redundant error handling.
* Wrap manual alarm signal/timeout handling into a context manager, add tests.

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

* update error message check in test

* update test timeout message assertions

---------

Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-30 10:45:10 -07:00
Brian Coca
d41a3430b7
async handling changed to use 'true' booleans(#85074)
async_status and async_wrrapper now use booleans instead of 0/1 for 'thruthyness'
gather_facts also updated

Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-30 08:32:49 -07:00
Martin Krizek
0e2f770a24
jinja2.__version__ is deprecated (#85221)
Prepare for its removal in Jinja 3.3.

See https://github.com/pallets/jinja/pull/2098
2025-05-30 11:40:10 +02:00
Matt Davis
91453e30af
Added _TEMPLAR_SANDBOX_MODE config (#85222)
* Added _TEMPLAR_SANDBOX_MODE config

* allows unsafe attribute checks to be disabled in Jinja sandbox

* Update lib/ansible/_internal/_templating/_jinja_bits.py

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

---------

Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-30 01:37:58 +00:00
Matt Davis
b71d9aa4a5
Decouple SSH client verbosity from Ansible display (#85224)
* decouple SSH client verbosity from Ansible display

* remove failing false-coverage unit test
2025-05-29 09:58:16 -07:00
Matt Davis
356bf336bd
fix from_yaml_all filter inconsistent None handling (#85223)
* fix from_yaml_all filter inconsistent None handling

* always returns empty list for None or empty string input

* deprecate non-string inputs for from_yaml and from_yaml_all
2025-05-29 09:50:01 -07:00
Harshvardhan Sharma
f05b1d1ccf
Improve SUSE distribution detection using VARIANT_ID with fallback (#85152)
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-05-29 09:20:15 -07:00
Martin Krizek
99a3346de6
dnf5 - handle all specific libdnf5 exceptions (#85175)
Fixes #84634
2025-05-29 11:51:12 +02:00
Kimmo Suominen
3b66150cc3
Recognize virtualization type correctly on Linode (#85184) 2025-05-27 17:27:01 +02:00
Martin Krizek
f635a22d81
apt_repository: remove Python 2 support (#85212) 2025-05-27 16:24:23 +02:00
Matt Clay
e226294855
display - Replace CRNL with NL (#85194) 2025-05-21 17:42:22 +00:00
Matt Clay
53b0f1645b
ansible-test - Add RHEL 10.0 remote (#85189)
* ansible-test - Add RHEL 10.0 remote

* Update tests for RHEL 10
* Fix iptables test
* Rework rpm_key integration test
2025-05-21 10:21:27 -07:00
Martin Krizek
c6a2e5ea75
csvfile lookup: remove Python 2 compat (#85186) 2025-05-21 09:54:24 -07:00
Jordan Borean
75f7b2267d
Add support for Windows App Control/WDAC (#84898)
* Add support for Windows App Control/WDAC

Adds preview support for Windows App Control, formerly known as WDAC.
This is a tech preview feature and is designed to test out improvements
needed in future versions of Ansible.

* Use psd1 and parse it through the Ast to avoid any unexpected execution results

* Add tests for various manifest permutations

* Ignore test shebang failure

* Apply suggestions from code review

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

* Use more flexible test expectations

* Add type annotations for shell functions

---------

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
2025-05-21 12:28:58 +10:00
Matt Clay
e82be177cd
ansible-test - Improve deprecated checking type inference (#85159)
* ansible-test - Improve deprecated checking type inference

Also disabled the ``bad-super-call`` pylint rule due to false positives.

* Add type comment support

* Try without using register_transform
2025-05-20 11:23:06 -07:00
Matt Clay
feda0a5c6e
ansible-test - Fix option filtering (#85182) 2025-05-20 11:11:45 -07:00
Matt Clay
1e64707592
Remove unnecessary module shebang (#85183) 2025-05-20 05:41:33 +00:00
Matt Clay
242bb9ebab
DTFIX recategorization and error/warning refactor (#85181)
Co-authored-by: Matt Davis <nitzmahone@redhat.com>
2025-05-20 00:48:00 +00:00
Jordan Borean
fe2d9e316a
Fix constructable inventory default keyed group (#85002)
Fix the logic for a constructable inventory `keyed_groups` entry to use
the `default_value` if the ``key` expression result is `None` or `omit`
and not just an empty string. This bug was introduced with the changes
in data tagging and goes back to the original behaviour.

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2025-05-15 09:52:47 -04:00
Matt Davis
e5476972da
ensure builtin tests always return bool (#85149)
* added unit test validation and coverage enforcement

Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-13 02:53:23 +00:00
Matt Davis
7be1359841
misc changelog and docstring cleanup (#85148)
* deferred listify_lookup_plugin_terms deprecation

Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-13 00:11:04 +00:00
Matt Davis
fc8a227647
ensure that all config return values are Origin-tagged (#85127)
Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-09 22:10:55 +00:00
Matt Davis
9efba4f972
apply trust to declarative plugin config (#85126)
* trust strings in loaded doc fragments
* added tests
* added hard_fail_context test mechanism

Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-09 19:33:33 +00:00
Lorenzo Tanganelli
8a4fb78988
facts: CloudStack KVM Hypervisor to Linux virtual fact (#85117)
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-05-09 11:52:27 -07:00
Matt Clay
7b69cf3266
ansible-test - Relax some deprecation checks (#85122) 2025-05-08 17:08:18 -07:00
Matt Clay
4fe9606530
template module - render None as empty string (#85121)
* template module - render `None` as empty string

* Update changelogs/fragments/template-none.yml

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

---------

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
2025-05-08 22:45:53 +00:00