* Fix a bug with the dnf module not using all components of a package name when filtering to determine if it's installed
* changelog
* Simplify splitting on the last '.'
* Update lib/ansible/modules/dnf.py
(cherry picked from commit b541a148d5)
mostly for use with network_os
use 'remote is local' property as indicator
ensure task_vars are as expected in test
(cherry picked from commit 8d41b97329)
Test for the required binaries in the can_handle_archive() method and fail there. This
prevents failures for missing binaries unrelated to the archive type.
* Update missing zip binary message to match tar message
* Update unit tests
* Add integration tests
* Define packages based on the system rather than ignoring failures
(cherry picked from commit 004c33d9c5)
Co-authored-by: Sam Doran <sdoran@redhat.com>
* Improve handling of AnsibleModule arguments in validate-modules (#75332)
* Make sure AnsibleModule positional arguments are validated.
* Extract ANSIBLE_MODULE_CONSTURCTOR_ARGS with inspection.
* Remove no longer necessary return value.
* Fix PR #.
* argument_spec might not have been specified, as in community.general.xenserver_facts.
* Fix typo.
(cherry picked from commit 7726b70d9a)
* Make sure self doesn't end up in fake.args (#75403)
(cherry picked from commit 2455d82c14)
Co-authored-by: Matt Martz <matt@sivel.net>
* Fix when evaluation on Native Jinja and Python 3.10
* Add unit test
* Add explaining comment
* Enable jinja2_native before tests
Co-Authored-By: Matt Martz <matt@sivel.net>
* Sanity
* Return native template module instead of modifying globals
Co-authored-by: Matt Martz <matt@sivel.net>
(cherry picked from commit 58e38044fe)
* Add packaging to requirement of ansible-test
Fix#75353
After requires_ansible field was added as mandatory to runtime.yml
file, ansible-test fails to check this field if it doesn't have
packaging module.
[1] https://github.com/ansible/galaxy-importer/pull/124
(cherry picked from commit 40ca87a963)
Co-authored-by: Sergey <sshnaidm@users.noreply.github.com>
* Improve the error handling code
Rather than multiple return paths, have a single return and set the message based
on the type of failure.
* Add another test for non-specific failures
* Reorganize tests so failure tests are in one tasks file
* Remove os.stat() call and add changelog.
(cherry picked from commit afe6eb574e)
Co-authored-by: Sam Doran <sdoran@redhat.com>
ansible-test aws provider now creates and exposes a new tiny_prefix
variable to provide a shorter prefix for the AWS tests.
(cherry picked from commit 5b8fb4dcd3)
* Ensure we keep the original path as per cli
fixes#75126
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 60c9f045cc)
Since the task and connection both have the same 'retries' keyword, the task default
would override the connection value.
Do not pass 'retries' from the task to the connection options.
* Set ssh_connection retries default value back to 0
It was 0 before the move to config and was changed to 3 by accident.
(cherry picked from commit a8de35e131)
Co-authored-by: Sam Doran <sdoran@redhat.com>
* Use `sphinx_ansible_theme` Sphinx theme in docs (#74318)
(cherry picked from commit 346c7a765d)
* 🔥 Drop unused `core.css` file
This is a forgotten leftover from #74318 that should've been removed
earlier.
(cherry picked from commit ec408a69f1)
* Update docs requirements list (#74956)
* removes upper bound on sphinx version
* updates versions of docs build dependencies, adds known good requirements file
* adds instructions for using known_good_reqs file
(cherry picked from commit 58f26388be)
Co-authored-by: Sviatoslav Sydorenko <webknjaz@redhat.com>
Co-authored-by: Sviatoslav Sydorenko <wk@sydorenko.org.ua>
Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>
* Use the module redirect_list when getting defaults for action plugins (#73864)
* Fix module-specific defaults in the gather_facts, package, and service action plugins.
* Handle ansible.legacy actions better in get_action_args_with_defaults
* Add tests for each action plugin
* Changelog
Fixes#72918
(cherry picked from commit 5640093f1c)
* Fix tests for < 3.8
While mode is specified in check_mode, don't call lstat.
Since file may not present.
Fixes: #61185
(cherry picked from commit 7099657dd7)
Co-authored-by: Logistic Bot <logistic-bot@protonmail.com>
When an empty value is provided, no `version` attribute will exist on the `LooseVersion` or
`StrictVersion` object. We catch and handle this, but it's not immediatebly clear that an
AttributeError means an empty value was provided.
Specifically handle the case where value or version are empty and add more
helpful error messages.
Add integration tests.
(cherry picked from commit 71e33d2578)
Co-authored-by: Sam Doran <sdoran@redhat.com>
* Localization: Import first set of translated files
(cherry picked from commit d45c2cec55)
* Ignore smart quotes in the dev guide translation.
The smart quotes are in the warning message to not use smart quotes.
(cherry picked from commit 3f694e9f02)
Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
* Only remove crontabs if they are empty
(cherry picked from commit fefda12827)
* Add integration test to ensure system cron tab doesn't get removed. Increase cron integration tests separation.
(cherry picked from commit 1e37fa86b4)
* Also detect crontab which only contains whitespace as empty.
(cherry picked from commit 4b69c8f501)
* cron integration test: Adjust system crontab path to be distribution specific.
(cherry picked from commit 70be3730db)
* Add changelog fragment for #74497.
(cherry picked from commit c606b50a3d)
Co-authored-by: Fabian Klemp <fabian.klemp@elara-gmbh.de>
* Map Debian 8 to Python 2
If Python 3 is installed on Debian 8 Ansible cannot run, as the version
is too old (3.4)
* Add integration test for python interpreter discovery on Debian 8
* fix test issue on Debian 9, add changelog
* un"fix" not broken test :D
Co-authored-by: Fabian Klemp <fabian.klemp@elara-gmbh.de>
Co-authored-by: Matt Davis <mrd@redhat.com>
(cherry picked from commit 437a08eb6d)
Co-authored-by: elara-leitstellentechnik <elara-leitstellentechnik@users.noreply.github.com>
Homebrew's default install location for macOS on ARM is /opt/homebrew.
Source: https://docs.brew.sh/FAQ
On a Mac M1 (Apple Silicon), homebrew will be installed at
/opt/homebrew/bin/brew.
Change:
- Newer Solaris drops setfacl. Add a fallback for its chmod ACL syntax.
Test Plan:
- New units
Tickets:
- Fixes#74282
Signed-off-by: Rick Elrod <rick@elrod.me>
Change:
- Regression introduced in #70785
- When macOS chmod ACL syntax is used, Solaris-derived chmods return
with a status of 5. This is also used for our sshpass handling,
because sshpass will return 5 on auth failure. This means on Solaris,
we incorrectly assume auth failure when we reach this branch of logic
and try to run chmod with macOS syntax.
- We now wrap this specific use of chmod in an exception handler that
looks for AnsibleAuthenticationFailure and skips over it. This adds
another authentication attempt (something we normally avoid to prevent
account lockout), but seems better than the regression of not allowing
other fallbacks to be used.
- Without this patch, if setfacl fails on Solaris (and sshpass is used),
we do not try common_remote_group or world-readable tmpdir fallbacks.
Test Plan:
- New unit
Signed-off-by: Rick Elrod <rick@elrod.me>
also added general note on how defaults work.
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Sam Doran <sdoran@redhat.com>
(cherry picked from commit 30912b6a47)
On some systems, curses.tigetstr() returns None, which does not work as a control character.
* Add unit tests
* Sort imports
* Skip on older Python
This is an action plugin and only runs on the controller, so no need to test of Python 2. Making
the import hackery work on Python 2 would required some more work which I am not sure is
worth it since we are moving away from Python 2 support on the controller.
* Make the tests work on Python 2 and 3
(cherry picked from commit 55b401a3e7)
Co-authored-by: Sam Doran <sdoran@redhat.com>
* Get available collection versions with page_size=100 for v2 and limit=100 for v3
* Update unit tests for larger page sizes
* Add a generic retry decorator in module_utils/api.py that accepts an Iterable of delays and a callable to determine if an exception inheriting from Exception should be retried
* Use the new decorator to handle Galaxy API rate limiting
* Add unit tests for new retry decorator
* Preserve the decorated function's metadata with functools.wraps
Co-authored-by: Matt Martz <matt@sivel.net>
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
(cherry picked from commit ee725846f0)
* support separate role argspec file in ansible-core
* support both .yml and .yaml extensions on argspec file in ansible-doc
* fix filename building bug and rename some argspec files to test variations
* use yaml extensions from constants
* add superfluous meta/main.yml files to tests
* Update lib/ansible/cli/doc.py
* update docs
* add changelog and allow for main.yml variations
* add collection role testing
Co-authored-by: Sam Doran <sdoran@redhat.com>
(cherry picked from commit 8fb54885bf)
From the sha512sum man page:
... The default mode is to print a line with checksum, a character indicating type ('*' for binary, ' ' for text), and name for each FILE.
(cherry picked from commit 403a5d147d)