Commit Graph

6278 Commits (76fb182b63a321aa513ee1c259eb39dd390e94c5)

Author SHA1 Message Date
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>
6 months ago
Maxim Evtush 778fdcbef1
Fix Typo in Variable Name and Update Test Data for Identifier Validation (#85338) 6 months ago
FT f6be5ab224
Fix Typos in Comments and Task Names (#85330)
* Update windows.yml

* Update test_manifest.yml
6 months ago
Matt Davis ed90a424a9
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>
6 months ago
fuder.eth f7e0612a85
Fix Typos in Integration Test Comments and Documentation (#85322)
* Update specific-revision.yml

* Update main.yml
6 months ago
Brian Coca 02c21742a3
Assemble add check mode (#85094)
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
6 months ago
kilavvy a09b25a356
Minor Documentation and Comment Corrections (#85313)
* Update New-AnsiblePowerShellSignature.ps1

* Update ultimatequestion.yml
6 months ago
Brian Coca 8ec403a3b9
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.
6 months ago
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>
6 months ago
leopardracer 56de597fc7
Fix typos in documentation and test ignore list (#85303)
* Update ignore.txt

* Update invalid_choice_value.py
6 months ago
Matt Clay c8324aa01a
Fix bool filter for non-hashable types (#85300) 6 months ago
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>
6 months ago
Matt Clay 714f796384
Fix nested include with templating (#85295) 6 months ago
Matt Clay 45dd2c0647
AnsiballZ refactoring and remote debug support (#85289) 6 months ago
David Shrewsbury aa8d58a174
get_url - check for incomplete data read (#85164) 6 months ago
Martin Krizek 532edf4c35
Fix templating tags on plays and roles (#82314)
Fixes #69903

ci_complete
6 months ago
Martin Krizek 600c1e67b4
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>
6 months ago
Matt Davis 43c0132caa
adjust PluginInfo to use PluginType enum (#85277)
* normalization fixups

Co-authored-by: Matt Clay <matt@mystile.com>
6 months ago
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
6 months ago
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>
6 months ago
Martin Krizek ea7ad90c31
Fix calls to `deprecated()` to include `help_text` arg (#85262)
Co-authored-by: Matt Clay <matt@mystile.com>
6 months ago
Matt Clay 1c06c46cc1
Fix YAML loading/dumping and filters (#85266)
- from_yaml/from_yaml_all filters now preserve trust
- YAML dumping can once again handle undecryptable vaulted values
- increased test coverage

Co-authored-by: Matt Davis <nitzmahone@redhat.com>
6 months ago
Matt Davis df0b417f2d
Resolve misc DTFIX0/1 (#85247)
* complete DTFIX0 after eval

* sunder-prefix Marker.concrete_subclasses

* re-home Jinja plugin decorators public API

* low-hanging/already fixed DTFIX cases

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

---------

Co-authored-by: Matt Clay <matt@mystile.com>
6 months ago
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>
6 months ago
Martin Krizek 01bb9393d7
Merge dnf and dnf5 integration tests (#85199) 6 months ago
Jordan Borean b4741fc495
Exclude ansible._protomatter from ansible-doc output by default (#85115)
* Exclude ansible._protomatter from ansible-doc output by default

* Added changelog
6 months ago
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>
6 months ago
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>
6 months ago
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>
6 months ago
Matt Davis b71d9aa4a5
Decouple SSH client verbosity from Ansible display (#85224)
* decouple SSH client verbosity from Ansible display

* remove failing false-coverage unit test
6 months ago
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
6 months ago
Martin Krizek 99a3346de6
dnf5 - handle all specific libdnf5 exceptions (#85175)
Fixes #84634
6 months ago
Martin Krizek a0132fec0b
dnf5 tests: do not remove attr (#85218)
On RHEL 10, the attr package is in the dependency tree of dnf itself
and cannot be removed.
6 months ago
Matt Clay e226294855
display - Replace CRNL with NL (#85194) 7 months ago
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
7 months ago
Martin Krizek c6a2e5ea75
csvfile lookup: remove Python 2 compat (#85186) 7 months ago
Matt Clay 6a1c24ca99
Limit SSH agent DSA testing to RHEL 9 (#85193) 7 months ago
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>
7 months ago
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
7 months ago
Matt Clay 242bb9ebab
DTFIX recategorization and error/warning refactor (#85181)
Co-authored-by: Matt Davis <nitzmahone@redhat.com>
7 months ago
Martin Krizek 40c919d7bd
Integration tests clean up (#85130)
* Integration tests clean up

* more

* we only test with Ubuntu 24.04 on the controller
7 months ago
Lee Garrett ebd022ee42
Mark integration tests as needs/root (#84487)
For calling setup_test_user, which adds a user to the system (and thus requiring
root):
- become
- become_su
- become_sudo
- slurp

And also:
- apt, which installs/removes system packages
- deb822_repository, which adds/removes apt repos
- hardware_facts calls losetup, which requires root
- package_facts, which installs/removes system packages

Co-authored-by: Lee Garrett <lgarrett@rocketjump.eu>
7 months ago
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>
7 months ago
Matt Davis f5a85493c1
recategorize pass over DTFIX-MERGE entries post b4 (#85155) 7 months ago
Matt Clay 567fda6906
Add missing cache plugin test scenarios (#85154) 7 months ago
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>
7 months ago
Matt Clay 7b69cf3266
ansible-test - Relax some deprecation checks (#85122) 7 months ago
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>
7 months ago
omahs 471c5229a7
Fix typos (#85107) 7 months ago
Matt Davis ff6998f2b9
Switch to stackwalk caller ID (#85095)
* See changelog fragment for most changes.
* Defer early config warnings until display is functioning, eliminating related fallback display logic.
* Added more type annotations and docstrings.
* ansible-test - pylint sanity for deprecations improved.
* Refactored inline legacy resolutions in PluginLoader.

Co-authored-by: Matt Clay <matt@mystile.com>
7 months ago
Jordan Borean e4cac2ac33
Add win_script become tests (#85079) 7 months ago
Brian Coca 9f894b81c2
ensure predictable permissions on module artifacts (#84948)
and test it!
7 months ago
Martin Krizek cff49a62ec
dnf5: avoid generating excessive history entries (#85065)
Fixes #85046
7 months ago
Brian Coca aab732cb82
show internal but not hidden config options, while still hiding test options (#84997) 7 months ago
Matt Davis 03181ac87b
Implement TaskResult backward compatibility for callbacks (#85039)
* Implement TaskResult backward compatibility for callbacks
* general API cleanup
* misc deprecations

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

* fix v2_on_any deprecation exclusion for base

---------

Co-authored-by: Matt Clay <matt@mystile.com>
7 months ago
Abhijeet Kasurde 1daa8412d5
comment: raise an exception when an invalid option is provided (#84984)
Co-authored-by: Matt Clay <matt@mystile.com>
Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
8 months ago
Brian Coca 2cbb721f6f
normalize error handler choices (#84998)
use existing to avoid deprecation cycle
normalize test too
8 months ago
Matt Clay e6dc17cda4
Increase galaxy test publish timeout (#85016) 8 months ago
Matt Clay f7d03474a5
Disable retries on ansible-galaxy-collection (#85013) 8 months ago
Matt Clay 6cc97447aa
Miscellaneous DT fixes (#84991)
* Use `_UNSET` instead of allowing `ellipsis`

* Fix deprecation warning pre-check

* Deprecation warnings from modules can now be disabled.
* Deprecation warnings from modules get the "can be disabled" notice.

* Include help text in pre-display fatal errors

* Simplify lookup warning/debug messaging

* Fix return type of `timedout` test plugin

* Use `object` for `_UNSET`

* Remove obsolete `convert_data` tests

* Remove unnecessary template from test

* Improve legacy YAML objects backward compat

* Fix templar backward compat for None overrides
8 months ago
Matt Clay e094d48b1b
Disable parallel publish in galaxy test (#85000) 8 months ago
Abhijeet Kasurde 500a4aba08
filter_core integration test - remove Python 2.6 related dead code (#84985)
Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
8 months ago
Felix Fontein 352d8ec33a
ansible-doc: fix indent and line wrapping for first line of (sub-)option and (sub-)return value descriptions (#84690)
* Fix initial indent for descriptions of suboptions.
* Fix line width for initial line of option descriptions.
8 months ago
Matt Davis 35750ed321
Templating overhaul, implement Data Tagging (#84621)
Co-authored-by: Matt Davis <mrd@redhat.com>
Co-authored-by: Matt Clay <matt@mystile.com>
8 months ago
Brian Coca 6fc592df9b
Fix uninstall tests (#84973)
match file name to package_manager detection of dnf5
8 months ago
Matt Clay 3d30e05bb4
ansible-test - Improve runme.sh error handling (#84972) 8 months ago
Abhijeet Kasurde c54ff7de41
Filter: add support for URL-safe encoding/decoding in b64* (#84949)
* Added support for URL-safe decoding into b64decode
* Added support for URL-safe encoding into b64encode

Fixes: #84147

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
8 months ago
Martin Krizek 244c2f06ed
Add ssh-agent launching, and ssh-agent python client (#84754)
* Add ssh-agent launching, and ssh-agent python client

* Move things around, is this better??

* docs

* postpone creating dir after bin lookup

* fix method name

* changelog ssh agent

* address reviews

* fix typing

* do not redefine public_key

* typing

* more typing

* Catch OSError when starting ssh agent

* likely copy pasted old code

* var type fix

* why is this needed?

ci_complete

* ignoring the change for now

* write out pub key file atomically

* defensive timeout for the socket

* _populate_agent docstring

* do not allow setting these in config

* check expected length before slicing blobs

* test all key types

* remove lock/unlock functionality

* docstring

* private _ssh_agent

* .

* launch agent in cli and ansible_ssh_*

* additional info for ssh-agent comment

* Add tests for remove and remove_all

* comment on os.rename

* hopefully mitigate agent startup/delays problems

* exceptions

* unused import

* fix sanity

* perf

---------

Co-authored-by: Matt Martz <matt@sivel.net>
8 months ago
Brian Coca 4bc4030988
ansible-pull fix adhoc output inconsistencies on changed (#84869)
Two fixes for single bug:
  - ignore callback changes for adhoc
  - allow 'yaml' change matching
---------

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
8 months ago
Matt Martz fd76cc2821
Revert "basic: remember the user sensitive information to use later (#84699)" (#84959)
This reverts commit 19e9f3dae2.
8 months ago
Abhijeet Kasurde 19e9f3dae2
basic: remember the user sensitive information to use later (#84699)
* Git allows embedding username and password in repo URL for
  https authentication. This may lead to exposing the user sensitive
  information to logs and unautheticated users.
  Adding no_log will partially solve this.
* Added documentation warning user about URL embedded with username
  and password.
* Added logic to remember user sensitive information for later sanitization

Fixes: #84557

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
8 months ago
Matt Clay 462affa7c4
Clean up interpreter discovery (#84394)
* Clean up interpreter discovery

- Deprecated `auto_legacy` and `auto_legacy_silent`
- Removed obsolete platform fallback config and logic
- Replaced unit tests with integration tests
- Increased test coverage
8 months ago
Jordan Borean b7d76a93b2
Fix up coverage with async on Windows (#84917)
Fixes the coverage collection for Windows and async tasks. This ensures
the async task still has access to the PSHost so that it can access the
runspace debugger tasks on the host.
8 months ago
Abhijeet Kasurde 2a4b1c8248
ansible-config: Dump galaxy server config in proper JSON format (#84912)
Fixes: #84840

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
8 months ago
Jordan Borean 7d0886457a
Windows Exec Runner Update (#84868)
Updates the Windows exec runner in preparation for the WDAC changes.
This new process is designed to improve the way modules are run by
Windows and expose common functionality to run PowerShell code in a
common environment. It also includes futher changes to improve the error
handling to make it easier to see where an error occurred in the running
code.
8 months ago
Matt Clay b3d21e3ad2
Fix apt and dpkg_selections tests (#84900)
* Fix apt and dpkg_selections tests

The tests now support aarch64.
They also have reduced dependencies on URLs hosted on third-party servers.

* Skip tests on unsupported platforms

* Use same package version for both tests

* Fix multi-arch support for Ubuntu 22.04
8 months ago
Matt Clay 87422526f5
Expand tests for apt_repository (#84904) 8 months ago
Matt Clay 35665db4ed
Miscellaneous integration test fixes (#84871) 9 months ago
Brian Coca 0d4f00f5c8
needed intesect, not difference (#84839)
fixes #84750

Added tests to verify output when using smart + others
9 months ago
Robert Muir 61a6222e0e
uri: form location correctly from relative redirect (#84541)
* uri: form location correctly from relative redirect

Previously, the original URL would be combined with the relative location incorrectly, especially for URL of any complexity.

Add simple tests demonstrating the problem that fail without the fix

* fix pylint error, import the method similar to other uri methods

* add changelog fragment

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
9 months ago
Matt Martz 3684b4824d
Remove reliance on `sshpass` and utilize `SSH_ASKPASS` (#83936)
* Add SSH_ASKPASS as an alternative means to provide ssh with passwords
9 months ago
Martin Krizek 7fbaf6cfcf
dnf5: fix is_installed check for provided packages (#84802)
Fixes #84578
9 months ago
Martin Krizek 09391f38f0
dnf tests: unique environment/group name (#84785)
Prevents `Group state for \"customenvgroup\" not found` error which may
or may not be a regression in dnf5. Just name groups/envs uniquely to
workaround the issue.
9 months ago
Abhijeet Kasurde 532e3ea3ec
test: error handling in include_role (#84737)
Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
9 months ago
Matt Clay 9ef623a517
Integration test cleanup (#84763)
This brings in integration test fixes from the data tagging PR which are unrelated to DT changes.
9 months ago
Matt Martz 2a3c93f593
Deprecate strategy plugins (#84728)
* Deprecate strategy plugins. Fixes #84725
10 months ago
Jordan Borean a742e20fca
ansible-test validate-modules - fix ps util checks (#84610)
* ansible-test validate-modules - fix ps util checks

Fix the module util import checks done by `ansible-test sanity --test
validate-modules` to support the newer `#AnsibleRequires` import
statement and `-Optional` flag.

* Fix sanity issues
10 months ago
Lee Garrett d21788a9b4
Fix integration tests on debian (#84379)
* Simplify conditional for service_facts integration test

This test requires systemd, so just test for that. Also fixes running this on
Debian testing/unstable releases, where ansible_distribution_version is "n/a".

* Clean up after service_facts integration test

* Simplify set_fact in interpreter_discovery_python test

Those vars are always set, either to something discovered, or "n/a". There are
no evaluations against the value "unknown".

* interpreter_discovery_python: Fix Debian test

Debian doesn't set VERSION_ID in /etc/os-release on pre-releases, see
https://bugs.debian.org/1008735

ansible 2.17 onwards does not support python 2.7 anyway.

* fix deb822_repository integration test failure on Debian

* Fix integration test hostname for Debian

* Fix integration test mount_facts

Some VMs might only have a single mount point, so they only have a single UUID.

* Add package deps for integration test subversion

/usr/bin/htpasswd is shipped in apache2-utils and needed by the main playbook.

* Fix integration test "service" on Debian sid

Debian sid does not set ansible_distribution_version, as such any tests assuming
it's a numeric value will fail. Since this is ancient test code that predates
ansible_service_mgr, remove the error-prone heuristic and rely on that var
instead.

* Fix service integration tests not running on *BSD

---------

Co-authored-by: Lee Garrett <lgarrett@rocketjump.eu>
10 months ago
simonLeary42 55e9e21ded
better error message for malformed documentation (#84705)
No the file name that caused the error will be apparent
---------

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
Co-authored-by: Abhijeet Kasurde <Akasurde@redhat.com>
10 months ago
Martin Krizek cc30f25c42
Make timeout on become an unreachable error (#84589)
* Make timeout on become an unreachable error

Fixes #84468
10 months ago
Matt Davis 5d7b8288f8
Fix local connection and become issues (#84700)
* Fixed various become-related issues in `local` connection plugin.
* Fixed various issues in `sudo` and `su` become plugins.
* Added unit and integration test coverage.

Co-authored-by: Matt Clay <matt@mystile.com>
Co-authored-by: Matt Davis <nitzmahone@redhat.com>
10 months ago
Abhijeet Kasurde 411b7985a5
test: Enable group tests for Alpine (#84652)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
10 months ago
Abhijeet Kasurde d0110ff691
test: enable user test for alpine (#84644)
* test: enable user test for alpine

* Disable user home update tests

* Disable some more tests which are not applicable for Alpine

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
10 months ago
Sloane Hertel d049e7b1b3
fix broken ansible-galaxy-collection resolvelib test (#84626) 10 months ago
Sloane Hertel a086c34a91
linear - don't treat end_role as a run_once task (#84673) 10 months ago
Sloane Hertel 333ee8d010
Test include_vars reserved variable matching (#84678)
* Add test case for include_vars

* Revise test to catch erroneous warnings
10 months ago
🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) ee49adfaf4
🧪🔥 Delete the `egg-info` integration test (#84686)
Previously, the integration test depended on luck. `setuptools` used
to be bundled in Python stdlib's `ensurepip`. Python 3.12 and newer no
longer include it. This test imports `pkg_resources` that is a part of
`setuptools`, meaning that it'll run out of luck at some point, under
newer Python runtimes.

This test does not seem to be useful to us so instead of fixing it, we
remove it from the repo [[1]].

Supersedes #84681.

[1]: https://github.com/ansible/ansible/pull/84681#discussion_r1945525317
10 months ago
Matt Clay ce392dd86e
Revert "generator: add support for extra vars usage (#84544)" (#84619)
This reverts commit 186c716af1.
10 months ago
Abhijeet Kasurde e6adddcaf8
debug: hide loop variables while using var (#84597)
Fixes: #65856

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
10 months ago
Abhijeet Kasurde c9097f73a2
uri: Handle HTTP exception raised (#84015)
* Handle HTTP exceptions raised when reading the content
  such as IncompleteRead

Fixes: #83794

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
11 months ago
Abhijeet Kasurde 186c716af1
generator: add support for extra vars usage (#84544)
* generator: add support for extra vars usage

Fixes: #83270

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

* CI green

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

* Review requests

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

* Review requests II

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

---------

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
11 months ago
Brian Coca 4953fc7b26
Apt key bye (#84555)
* apt-key module updates due to debian removal

Still kept for now for backwards compat, but removing from testing when not present
And adding more explicit mesasges to errors to point to new module

* added docs and error msg

* clog

* aslkdfj

* no docs to document doc changes

* also add warning to apt_repository

* clog on apt_repo too

* fix string concat

* Apply suggestions from code review

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>

---------

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
11 months ago
Martin Krizek 3b6d086f5e
targets/handlers: fix incorrect test cmd (#84567) 11 months ago
Jordan Borean 8c5e33cd3a
Ansible.Basic - Fix required_if check (#84562)
Fixes the Ansible.Basic `required_if` check when the option to check is
either unset or explicitly set to null.
11 months ago
Brian Coca 675d7201d8
fix template (#84563)
also fix gather_subset warning and add some comments/notes
---------

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
11 months ago
Lee Garrett 3030c79331
user: Fix homedir permissions when UMASK is unset in /etc/login.defs
When a user doesn't exist and user module is used to create the user and the
homedir, adduser is called which parses HOME_MODE from /etc/login.defs, and when
not set calculates the mode from UMASK from the same file.

When a user already exists without homedir, and the user module is used to add a
home dir, it incorrectly ignores HOME_MODE, resulting in a world-readable home
dir when UMASK is not set. This is for example the case in Debian trixie and
later, and likely Ubuntu 25.04 and later.


Signed-off-by: Lee Garrett <lgarrett@rocketjump.eu>
Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
11 months ago
Matt Clay 5623a386c1
Fix unit and integration tests (#84554)
This is a follow-up to https://github.com/ansible/ansible/pull/84473
11 months ago
Lee Garrett 73180c0630
ansible-vault integration test fix (fixes: #83837) (#84486)
Correct the test that expects an error when using ansible-vault to write against
a non-writeable dir. Skip the test as root, as root can always write.

Co-authored-by: Lee Garrett <lgarrett@rocketjump.eu>
11 months ago
Abhijeet Kasurde 5b0d170496
get_url: add support for BSD-style digest (#84485)
* Added support for BSD-style digest file to test
  checksum of downloaded file.

Fixes: #84476

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
11 months ago
Brian Coca 20baf29a2a
fix warnings about reserved variable names to cover all sources (#84432)
Also remove redundant check from tqm
Now covers module output (set_fact/include_vars)
Includes play objects at any stage (tasks that error were not covered)
Added tests, moved them to role structure
11 months ago
Matt Clay 96f7090acc
Use ECR Public for container test (#84537) 11 months ago
Matt Clay 1b3face065
ansible-test - Replace FreeBSD 14.1 with 14.2 (#84527)
* ansible-test - Replace FreeBSD 14.1 with 14.2

* Remove cron faketime testing from FreeBSD
11 months ago
Matt Clay 648dcd3a6a
ansible-test - Replace Fedora 40 with 41 (#84281)
* ansible-test - Replace Fedora 40 with 41

Also update other distro containers to remove unnecessary packages:

* apache2
* subversion
* ruby

* Fix subversion test on Ubuntu

Also remove obsolete vars files from subversion test.

* Skip dnf test on Fedora 41+

The dnf5 test is all that is needed.

* Support dnf5 for the package test

* Extend unix-chkpwd work-around for Fedora
11 months ago
Matt Clay 91f4b71d40
Fix uri integration test on Python 3.13 (#84518) 11 months ago
Matt Clay 5ec236b564
Fix result_pickle_error integration test (#84506)
The test has been updated to use a custom type which does not support pickling,
instead of relying on Jinja's `Undefined` type. As of Jinja 3.1.5 that type now
supports pickle, which breaks the original implementation of the test.
11 months ago
Brian Coca c64c389007
gather_facts, fix 'smart' handling with network os and 'setup' (#84425)
gather_facts, fix network_os and smart logic and defaults

setup will be default for smart only if network_os is not set, now you get warnings and errors when missing a valid facts module for a network os

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
12 months ago
David Lassig 106909db8b
adding option for form-multipart data to switch multipart encoding (#80566)
* adding option for form-multipart data to switch multipart encoding from default base64 to 7or8bit encoding

Co-authored-by: davlas <david.lassig@bwi.de>
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
12 months ago
Brian Coca 3c91eab0d8
copy, prevent internal options in task (#84422)
* copy, prevent internal options in task

fixes #84367
12 months ago
Herman van Rink 363c57b311
csvfile - let the config system do the typecasting (#82263)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
1 year ago
Abhijeet Kasurde ac110eb012
lookup_template: added trim_blocks option (#84254)
* Allow user to control the trimming of blocks while templating
* Added tests
* Updated documentation and example

Fixes: #75962

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
1 year ago
Sloane Hertel af2bb2c182
wait_for_connection - test connection=local does not emit warning (#84438)
Add test for PR 84421
1 year ago
Alex Willmer 59d9737788
fix reset_connection with templated connection variables (#84240)
* ssh: Test reset_connection with templated ansible_ssh_executable

Add failing test to confirm subsequent fixes are necessary & sufficient.

* ssh: Fix reset_connection with templated ansible_ssh_executable

Signed-off-by: Alex Willmer <alex@moreati.org.uk>
1 year ago
Abhijeet Kasurde b154e38e54
config lookup, fixes and tests (#84398)
* Integration tests for lookup_config

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
1 year ago
Lee Garrett 6d21e28c73
Fix non-root integration tests failure (#84378)
* Fix callback_default integration test for non-root users

This test compares the test output to previously collected output. However, this
previously assumed that the tests are run as root, even though needs/root in
aliases is not set.

So instead parameterize the output, and use sed to replace the value that
diverge when running it as different users.

* integration tests: Ensure temp file removal doesn't fail as non-root user

* Don't fail when ansible-galaxy integration test runs as non-root

* Update integration test callback list

---------

Co-authored-by: Lee Garrett <lgarrett@rocketjump.eu>
1 year ago
Abhijeet Kasurde 92cf41aa46
Additional tests for lookup_sequence (#84315)
* Additional tests for lookup_sequence

* Follow up for https://github.com/ansible/ansible/pull/83758,
  to add tests for stride parameter.
---------

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
1 year ago
Jordan Borean f9b58fa13f
ansible-test - fix coverage for test modules (#84366)
Fixes the coverage path translation for modules located in integration
test paths. Instead of trying to match by the unique temporary path name
that the module is executed as, the reporting tool will translate it to
the static path that the module is actually located under.
1 year ago
Lee Garrett f2a77b071e
Test aliases fix (#84377)
* integrity tests: Tag (destructive) root tests as such

- apt_key needs root to touch the apt key database
- debconf needs root to change debconf values of system packages
- gathering writes to /etc/ansible/*, writeable only to root
- group creates system groups
- noexec mounts/umounts a ramdisk
- systemd requires root to start/stop services

Mark all except noexec as "destructive" as they change the state of the system.

* integration test cron requires root, as it calls setup_cron

* integration test dpkg_selection runs dpkg as root

* integration test facts_linux_network requires root

It adds/removes IP addresses from network interfaces, requiring root for that.

* integration test package requires root

installs/removes system packages

* Integration test service requires root

Creates/starts/stops/removes systemd services

* integration test user requires root to create users

* integration tests using setup_test_user require root

---------

Co-authored-by: Lee Garrett <lgarrett@rocketjump.eu>
1 year ago
Martin Krizek 2a53b851fe
dnf5,apt: add auto_install_module_deps option (#84292)
* dnf5,apt: add auto_install_module_deps option

Fixes #84206
1 year ago
Martin Krizek c99493eb3f
dnf5 - consolidate package resolving settings (#84335)
Fixes #84334
1 year ago
Martin Krizek a27a7a27d1
dnf5: fix is_installed check (#84275)
Fixes #84259
1 year ago
Sloane Hertel 3e82ed307b
include_vars - fix including new hash variables when hash_behaviour is set to merge (#84303) 1 year ago
James Ramsaran e14f9fe725
Sequence query fix (#83758)
Co-authored-by: flowerysong <junk+github@flowerysong.com>
1 year ago
Abhijeet Kasurde ca0810da85
Add tests for deprecations (#84284)
* Check for module deprecation
* Check for module option deprecation
* Check for plugin deprecation

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
1 year ago
Brian Coca e404bc17f7
package_facts fix empty packages on foreign mgr (#83855)
* package_facts fix empty packages on foreign mgr

return the first package manager that provides output

add tests with fake rpm on apt machines
1 year ago
Jordan Borean 7501bbec20
Add support for Windows Server 2025 (#84285)
Adds Windows Server 2025 to the testing matrix.
1 year ago
Matt Clay a98801903d
ansible-test - Replace FreeBSD 13.3 with 13.4 (#84236)
* ansible-test - Replace FreeBSD 13.3 with 13.4
* ansible-test - Fix typos in bootstrap.sh
* Skip libfaketime on FreeBSD except FreeBSD 14
1 year ago
Sloane Hertel 157ef04b1e
Add --flush-cache option to ansible-pull (#84211) 1 year ago
Sloane Hertel 771f7ad29c
update ansible-galaxy resolvelib requirement to >= 0.5.3, < 2.0.0 (#84218)
* Update resolvelib upperbound to 2.0.0

Minor SemVer releases should not contain breaking changes

* Test the latest minor release and reduce number of resolvelib versions tested for efficiency
1 year ago
Abhijeet Kasurde 8784469b4c
encrypt: raise error on passing unsupported passlib hashtype (#84186)
* Raise an AnsibleFilterError when unsupported passlib hashtype is
  provided in do_encrypt.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
1 year ago
anvitpusalkar 2c6b78f516
Add --flush-cache option for ansible and ansible-console (#84149)
* Allow CLIs that accept inventory options to flush the inventory cache(s) and fact cache

Fixes #83749
1 year ago
Sloane Hertel 03acb22f99
Fix returning unreachable for looped tasks (#84049)
* Fix returning unreachable for looped tasks

Add tests for ignore_unreachable and loop
1 year ago
Sloane Hertel a3b58fb67c
Add a test using ignore_errors as a variable (#84175)
* Add a regression test for https://github.com/ansible/ansible/issues/32384
1 year ago
Abhijeet Kasurde f29b46e438
Remove deprecated plural form of collection path (#84156)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
1 year ago
Conner Crosby d662a8d088
Enable file module to disable diff_mode (#83700)
Several tasks within the modification_time.yml and state_link.yml task
lists have explicitly enabled diff_mode because these tests previously
assumed a diff attribute would always be returned from the file module.
1 year ago
Abhijeet Kasurde ab1a8cb3b3
docs: print deprecation collection name (#84126)
While showing the deprecation message, mention the collection name
from which the module is removed.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
1 year ago
Matt Davis c9ac477e53
Preserve `_ansible_no_log` from action result; fix `include_vars` to set properly (#84143)
* fixes for CVE-2024-8775

* propagate truthy `_ansible_no_log` in action result (previously superseded by task-calculated value)
* always mask entire `include_vars` action result if any file loaded had a false `show_content` flag (previously used only the flag value from the last file loaded)

* update no_log tests for CVE-2024-8775
* include validation of _ansible_no_log preservation when set by actions
* replace static values with dynamic for increased robustness to logging/display/callback changes (but still using grep counts :( )

* changelog

* use ternary, coerce to bool explicitly
1 year ago
Brian Coca 11e4a6a722
user module avoid conflicts ssh pub key (#84165)
Remove pub key if we are going to generate private
fix tests for os X
1 year ago
Abhijeet Kasurde 53ceb74e84
Use open with context manager (#83337)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
1 year ago
Sviatoslav Sydorenko (Святослав Сидоренко) f7766cf843
Trim `selinux_policytype` @ integration tests (#84136)
The shell command sometimes prints a trailing whitespace which breaks
the tests on old RHELs. This patch is supposed to fix that.
1 year ago
Colin Watson c6e166319a
test: use password to generate random string instead of range (#84129)
* Use password lookup instead of range
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
1 year ago