Commit Graph

12779 Commits (244c2f06edd3331495de27ecce2066cfa49d1e00)

Author SHA1 Message Date
Matt Clay f3ccd78cce
ansible-test - Update base/default containers (#84670) 10 months ago
Matt Clay cd881bf71e
ansible-test - Add pytest-mock to mypy sanity test (#84669) 10 months ago
Matt Clay 7594243fc0
ansible-test - Update sanity test requirements (#84667) 10 months ago
Matt Clay 21bc1d915d
ansible-test - Fix warning message grammar (#84666) 10 months ago
Matt Clay 4b38456e4f
ansible-test - Correct CLI arg type and annotation (#84664) 10 months ago
Matt Davis a6b5861c53
add lightweight core issue template for bot-ignored issues (#84638) 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
Jordan Borean f86c58e2d2
ssh - Improve CLIXML stderr parsing (#84569)
Improves the logic for parsing CLIXML values in the stderr returned by
SSH. This fixes encoding problems by having a fallback in case the
output is not valid UTF-8. It also can now extract embedded CLIXML
sequences in all of stderr rather than just at the start.
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
Matt Clay 7677bf1c9b
ansible-test - Use urllib intead of curl (#84551)
Also added automatic retries on HTTP request exceptions, since all currently implemented methods (GET/PUT/DELETE) are idempotent.
11 months ago
Brian Coca a046ef5a95
fix incongruent ansible-vault cli options (#84494)
prompt now only errors if stdin is specifically triggered and not due to lack of other args

fixes #84489
---------

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
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
Kristopher Newsome f727d74fc2
Allows iptables chain creation with wait parameter (#84491)
* Allows iptables chain creation with wait parameter

Fixes #84490

* Add the changelog fragment for 84490
11 months ago
Felix Fontein ae55f874a0
Enforce FQCNs in seealso plugin/module entries. (#84325) 11 months ago
Felix Fontein 60e2135c2b
Bump acme test container to 2.3.0 (#84547) 11 months ago
Matt Clay eb475e23f7
ansible-test - Update utility containers (#84545) 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 3b77277428
ansible-test - Fix FreeBSD instance CA certs (#84529)
Some versions and architectures come with `ca_root_nss` pre-installed.
However, at least FreeBSD 13.4 on aarch64 does not.
This change ensures the certificates will always be installed.
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 f552fe2c15
ansible-test - Replace RHEL 9.4 with 9.5 (#84526) 11 months ago
Matt Clay 35c4b58c11
ansible-test - Replace Alpine 3.20 with 3.21 (#84525) 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 eb6d581286
ansible-test - Update nios-test-container to 7.0.0 (#84517) 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
Abhijeet Kasurde f72aa1dc0c
test: Update regex for required and default in FieldAttributes (#84209)
Fixes: #61460

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
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
Abhijeet Kasurde 0f466bb75f
test: Remove dead code (#84436)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
1 year ago
Stefano Rivera d500354798
unarchive: Clamp zip timestamps on 32-bit time_t (#84409)
Clamp zip timestamps to representible values when unpacking zip files on
platforms that use 32-bit time_t (e.g.  Debian i386). This is a
non-issue in practice (in 2024), but should allow the test suite to pass
on Debian i386.

We use a round value of 2038-01-01 00:00:00 for simplicity, and to avoid
running into timezone offsets closer to the actual limit.

MR #81520 introduced sanity-checking tests that used dates not
representable with a 32-bit time_t.
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 1ad0c404ef
Coverage for virtual/sunos.py (#84357)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
1 year ago
Abhijeet Kasurde 2ca086c993
Coverage for virtual/hpux.py (#84362)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
1 year ago
Abhijeet Kasurde 5b231bbbdb
test coverage for virtual/sysctl.py (#84356)
* test coverage for virtual/sysctl.py

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
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
Abhijeet Kasurde 9588215601
Removed deprecated include_delegate_to param (#84306)
* Removed deprecated include_delegate_to param

* Remove deprecated include_delegate_to param from
  get_vars API in manager.py

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

* Make ignore.txt

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
Matt Clay 95e3af3e0f
ansible-test - Improve container network detection (#84323)
When detection of the current container network fails, a warning is now issued and execution continues.
This simplifies usage in cases where the current container cannot be inspected, such as when running in GitHub Codespaces.
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 52ecd3664a
ansible-test - align 2025 connection defaults to CI matrix (#84291) 1 year ago
Matt Clay 9d249432c4
Increase scope of mypy sanity test (#84288)
* Increase scope of mypy sanity test

* Fix issues reported by mypy
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
Alexei Znamensky 1d61f2a4fd
remove ignore clauses for module uri (#83642)
Co-authored-by: flowerysong <junk+github@flowerysong.com>
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
Matt Clay 68bfa37838
ansible-test - Fix interactive cmd traceback (#84264) 1 year ago
spyinx 9cdd6e58b3
Fixed ipv6 pattern in parse_address (#84237) 1 year ago
Abhijeet Kasurde f92e99fd8f
test: fix check_required_by (#84153)
* Update the documentation for check_required_by
* Fix return value for check_required_by (now returns empty list on success)

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
1 year ago
Sloane Hertel 32ae3ce117
Remove encrypt unit tests for undocumented algorithms, which are disallowed in 2.19. (#84219) 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 3a40ba3b2c
Remove deprecated pycompat24 and importlib (#84161)
* Removed deprecated pycompat24 and importlib

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

* Make CI green

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

* Ignore basic.py

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

* Make CI green III

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

* Make CI green IV

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

---------

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
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 b1816880cb
Remove deprecated compat.selector (#84155)
* Removed files related to selector compat

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
1 year ago
Abhijeet Kasurde 1e6ffc1d02
Fixed broken tests (#84088)
* Add `match=` in pytest.raises
* Remove redundant assert statements

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Matt Clay <matt@mystile.com>
1 year ago
Abhijeet Kasurde 1727bbecce
test: Remove unreachable tests (#83696)
variable_manager unit tests are unreachable. These tests
are already covered in integration tests.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
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
Abhijeet Kasurde 663f7f3b56
test for gathering FIPS facts (#83266)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
1 year ago
ShIRann Chen 58cb8ca4fa
feat: checksum_algo param for find module (#83014)
Co-authored-by: shirann <shirannx@gmail.com>
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <webknjaz@redhat.com>
1 year ago
Matt Clay 48be6f8b6f
ansible-test - Improve container probe error handling (#84109) 1 year ago
Brian Coca 6aaac6cab3
service_facts: add FreeBSD support (#82556)
new freebsd scanner using 'their version' of service cli tool
also avoid loading the linuxy service scanner when freebsd
1 year ago
Matt Clay 56bab1d097
Enable bad-docstring-quotes pylint rule for core (#84100)
* Enable bad-docstring-quotes pylint rule for core

* Ignore previously bulk update in git blame
1 year ago
Matt Clay a0495fc314
Update triple single quotes to triple double quotes (#84099)
* Update triple single quotes to triple double quotes

This change was fully automated.

The updated Python files have been verified to tokenize the same as the originals, except for the expected change in quoting of strings, which were verified through literal_eval.

* Manual conversion of docstring quotes
1 year ago
Matt Clay 62ce21b6e4
ansible-test - Work around pylint issue on 3.11 (#84094) 1 year ago
Matt Clay 83671ecb39
ansible-test - Enable pylint docstyle for tests (#84092)
This cleans up the implementation of the pylint sanity test and enables the docstyle extension rule `bad-docstring-quotes` for tests.

The rule will be enabled for the rest of ansible-core once automated cleanup has been performed on existing docstrings.
1 year ago
Matt Clay 0b661438a0
ansible-test - Update base/default containers (#84089) 1 year ago
Matt Clay 955e310b4c
Cover unit tests with mypy (#84084)
* Added support for testing unit tests with mypy.
* Added support for ignoring individual mypy error codes.
* Added missing assert on unit tests and marked xfail.
* Added type hints for some unit tests.
* Added ignores for unit tests not passing mypy.
* Fixed incorrect autouse argument in unit test fixtures.
* Fixed minor issues causing problems with mypy in unit tests.
1 year ago
Brian Coca 0959472bc6
user module, avoid chmoding symlink'd home file (#83956)
also added tests

---------
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
1 year ago