Commit Graph

12896 Commits (fb09e79b2f21573f44427c91e8d2f577fc968559)

Author SHA1 Message Date
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>
5 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)
6 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>
6 months ago
Matt Clay d808f11a44 Fix deprecated pylint plugin version parsing (#85402)
(cherry picked from commit 3511299e1e)
6 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)
6 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)
6 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)
6 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)
6 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)
6 months ago
Matt Davis 8c083e4d1d 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>
(cherry picked from commit db819d2514)
6 months ago
Matt Davis b23aa84a49 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>
(cherry picked from commit 11f5563895)
6 months ago
Patrick Kingston 68bf0a66cb Add test coverage to ansiballz builder source mapping (#85382)
Should bring code coverage in _builder.py to 100%.

(cherry picked from commit e7c7df7074)
6 months ago
Matt Davis b3dde82ab1 deprecate esoteric/undocumented playbook syntaxes (#85378)
Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 547c64f326)
6 months ago
Matt Davis d68954de83 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>
(cherry picked from commit 1f8937b57e)
6 months ago
Matt Davis 0ce6b45db2 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>
(cherry picked from commit 3c52b14c9e)
6 months ago
Martin Krizek 3de2b9082c Test both original and latest dnf versions (#85342)
Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit ef9d92b31d)
6 months ago
Matt Davis 9c0dc6c88a 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>
(cherry picked from commit dde10a9afb)
6 months ago
Matt Davis 9f7432c5ff display wrap/format arg cleanup (#85352)
Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit fa9f286096)
6 months ago
Matt Davis 03dc8c4260 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>
(cherry picked from commit 46abcfcc82)
6 months ago
Sloane Hertel 39ed1fc4bc 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>
(cherry picked from commit 8e9f5fb9d5)
6 months ago
Matt Clay b6ac61b487 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

(cherry picked from commit d922398c4d)
6 months ago
leopardracer 11ad0ae758 Update test-pause (#85347)
(cherry picked from commit 678c6abc98)
6 months ago
Matt Clay 0aa8a878cf Spelling fixes (#85345)
A few grammar fixes too.

(cherry picked from commit 83fcaeaa8b)
6 months ago
Matt Davis 59cdb65926 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>
(cherry picked from commit eec57ec396)
6 months ago
Maxim Evtush 19f3890275 Fix Typo in Variable Name and Update Test Data for Identifier Validation (#85338)
(cherry picked from commit 778fdcbef1)
6 months ago
FT 7d05c6e8e0 Fix Typos in Comments and Task Names (#85330)
* Update windows.yml

* Update test_manifest.yml

(cherry picked from commit f6be5ab224)
6 months ago
Matt Clay fd8d22e874 ansible-test - Fix relative import resolution (#85328)
(cherry picked from commit 093ac8df2d)
6 months ago
Matt Clay 69ac7b1278 Add type annotations to set_module_args (#85329)
(cherry picked from commit 025e9cfae6)
6 months ago
Matt Davis b708e53d08 fix script failed_when bypass (#85326)
* fix script failed_when bypass

* misuse of AnsibleActionFail for a retryable/alterable error case
* add tests

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

* type annotation fixes

---------

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit ed90a424a9)
6 months ago
fuder.eth b7158e7829 Fix Typos in Integration Test Comments and Documentation (#85322)
* Update specific-revision.yml

* Update main.yml

(cherry picked from commit f7e0612a85)
6 months ago
Matt Clay b5529ee064 ansible-test - Fix ansible-test debug from remote shell (#85321)
(cherry picked from commit 2991883672)
6 months ago
Matt Clay 865d69dab1 ansible-test - Add remote debugging support (#85317)
(cherry picked from commit 7ef13cb29e)
6 months ago
Brian Coca f29662138e Assemble add check mode (#85094)
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 02c21742a3)
6 months ago
kilavvy 80a00f60d6 Minor Documentation and Comment Corrections (#85313)
* Update New-AnsiblePowerShellSignature.ps1

* Update ultimatequestion.yml

(cherry picked from commit a09b25a356)
6 months ago
Brian Coca 05b3eafeae ansible-doc don't show empty paths (#85294)
If no path is given, it can only mean that it is a Jinja plugin, display Jinja as 'provider' then.

(cherry picked from commit 8ec403a3b9)
6 months ago
Matt Clay 3ad711aee4 ansible-test - Relocate internal CLI args (#85308)
This improves consistency by locating them with other global options.

(cherry picked from commit 4b0a5c5c63)
6 months ago
Matt Clay 9d83546b65 ansible-test - Move metadata to environment (#85307)
(cherry picked from commit 76ad0b636f)
6 months ago
Brian Coca d3f2c6d8f0 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>
(cherry picked from commit 7e495f4b20)
7 months ago
leopardracer 529776f0a1 Fix typos in documentation and test ignore list (#85303)
* Update ignore.txt

* Update invalid_choice_value.py

(cherry picked from commit 56de597fc7)
7 months ago
Matt Clay f2a0eef867 Fix bool filter for non-hashable types (#85300)
(cherry picked from commit c8324aa01a)
7 months ago
Sloane Hertel 58496bed29 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>
(cherry picked from commit d3977ebc88)
7 months ago
Matt Clay 1fe0fb0e7a ansible-test - Code cleanup (#85297)
(cherry picked from commit bdc6c8e16a)
7 months ago
Matt Clay b5a4fe62ed Fix nested include with templating (#85295)
(cherry picked from commit 714f796384)
7 months ago
Matt Clay 0cecfd9877 AnsiballZ refactoring and remote debug support (#85289)
(cherry picked from commit 45dd2c0647)
7 months ago
David Shrewsbury e2b831ce26 get_url - check for incomplete data read (#85164)
(cherry picked from commit aa8d58a174)
7 months ago
Martin Krizek 33c55b9c25 Fix templating tags on plays and roles (#82314)
Fixes #69903

ci_complete

(cherry picked from commit 532edf4c35)
7 months ago
Matt Davis b95bc19853 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>
(cherry picked from commit 2bed98bd20)
7 months ago
Martin Krizek eb29a662f6 Exceptions clean up (#85176)
* replace usage of `IOError` as it is an alias to `OSError`
* replace usage of `socket.error` as it is an alias to `OSError`
* use subclasses of `OSError` rather than inspecting `errno`s
* utilize `exist_ok` parameter of `os.makedirs` rather than ignoring
  `FileExistsError`

Make the following changes to the exception handling this patch already
updates to be consistent with the new code:
* use `ex` as a name for exception being handled
* use `from ex` when re-raising exception for additional context
* use f-strings and `!r` for quoting
* pass exceptions to the `exception` parameter of `fail_json`
* use `display.error_as_warning` rather than passing stringified
  exception into `display.warning`

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 600c1e67b4)
7 months ago
Matt Davis 0f2bc31753 adjust PluginInfo to use PluginType enum (#85277)
* normalization fixups

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 43c0132caa)
7 months ago
Matt Davis 7b823720ca 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

(cherry picked from commit 9f0a8075e3)
7 months ago