* [stable-2.10] Normalize ConfigParser between Python2 and Python3 (#73715)
* Normalize config parser between py2 and py3
* Add tests and changelog
* Use different config entry, since we supply certain env vars
(cherry picked from commit 950ab74)
* Update config entry
* galaxy: restore left hand slicing in assignment
Fix 'ansible-galaxy role init --role-skeleton=role-skeleton' when the role skeleton
contains an ignored directory.
The issue was because the 'dirs' variable was changed to reference a different list,
but needs to be mutated instead to stop os.walk from traversing ignored directories.
Fixes: #71977
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit eb72c36a71)
Co-authored-by: manas-init <70483021+manas-init@users.noreply.github.com>
* find module - stop traversing directories with os.walk when depth is already exceeded (#73718)
(cherry picked from commit 8628c12f30)
* Update tests since there are fewer prior tasks creating files/directories
Ensure `yamllint`'s `check_assignment()` correctly ignore the
attribute assignment. Those don't have any `.id` attribute and will
trigger an `AttributeError` exception.
See: https://github.com/ansible/ansible/pull/73322
(cherry picked from commit 0a8d5c0983)
Until now, the lookup plugin returned a byte string.
Changed this to output a unicode string instead.
(cherry picked from commit d0fda3e901)
Co-authored-by: Alexander Sowitzki <asowitzk@redhat.com>
Change:
- podman > 2 && < 2.2 does not support "images --format {{json .}}"
- podman also now outputs images JSON differently than docker
- Work around both of the above.
Test Plan:
- Tested with podman 2.0.6 in Fedora 31.
Signed-off-by: Rick Elrod <rick@elrod.me>
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
(cherry picked from commit 0332046699)
Co-authored-by: Rick Elrod <rick@elrod.me>
Only add data when there is data to add
also avoid clobbering existing data with empty file
fixes#45843
* remove redundant code, update comments
* fix mock dataloader, original does not return None
* added test
(cherry picked from commit ec8a556538)
* Add changelog and fixtures for AlmaLinux support
Co-authored-by: Christoph Schug <com+github@schug.net>
(cherry picked from commit 2f5c83dfb1)
Co-authored-by: Sam Doran <sdoran@redhat.com>
* Split Ansible docs from core docs (#73616)
* excludes scenario guides from core docs, splits porting guides and roadmaps, symlinks indices to create index.html pages, and adds .gitignore entries for conf.py and the toplevel index.rst files generated by the docs build
This solution builds three types of docs:
* ansible-2.10 and earlier: all the docs. Handle this via `make webdocs
ANSIBLE_VERSION=2.10`
* ansible-3 and later: a subset of the docs for the ansible package.
Handle this via `make webdocs ANSIBLE_VERSION=3` (change the
ANSIBLE_VERSION to match the version being built for.
* ansible-core: a subset of the docs for the ansible-core package.
Handle this via `make coredocs`.
* `make webdocs` now always builds all the collection docs
* Use `make coredocs` to limit it to core plugins only
* The user specifies the desired version. If no ANSIBLE_VERSION is specified, build plugins for the latest release of ansible
Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit ccbfdec334)
* fix CI failures, correct version switcher and makefile logic, set args in all cases, allow 2.10 build
Co-authored-by: Sandra McCann <samccann@redhat.com>
Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com>
When the pause module is run in the background and seconds parameter is provided,
do not warn.
* Add tests
* Fix existing tests
The test wasn't failing when it should have.
(cherry picked from commit 0e6c334115)
Co-authored-by: Sam Doran <sdoran@redhat.com>
If a YAML file fails to load due to a syntax error in a file, or there is an error in the last line of a
file, PyYAML reports the last line number of the file as the index where the error occurred.
When reading the file lines, we use that index to the get the relevant line. If the index value is out
of range, the relevant line is lost for error reporting.
Subtract one from the index value to avoid the IndexError in this specific scenario. It is possible
to still get an IndexError, which will be handled as it is currently.
* Update existing tests and add new tests
(cherry picked from commit e8d4b62b41)
Co-authored-by: Sam Doran <sdoran@redhat.com>
Ability to add local variables into AnsibleJ2Vars was added in
18a9eff11f to fix#6653. Local variables
are added using ``AnsibleJ2Vars.add_locals()`` method when creating a
new context - typically when including/importing a template with
context. For that use case local template variables created using
``set`` should override variables from higher contexts - either from the
play or any parent template, or both; Jinja behaves the same way.
Also removes AnsibleJ2Vars.extras instance variable which is not used.
Also adds missing test for #6653.
Fixes#72262Fixes#72615
ci_complete
(cherry picked from commit a2af8432f3)
Change:
- Allow older git to verify tags again
- Enable verification tests everywhere, even if most of them only work
on newer git. Some of them work on older git and they test the --raw
parameter.
Test Plan:
- Re-enabled subset of git tests
Tickets:
- Fixes#64469
Signed-off-by: Rick Elrod <rick@elrod.me>
* Ensure we actually fallback to unsafe_writes when set to true
add integration test
add fix for get_url not passing the parameter from args
(cherry picked from commit 932ba36160)
* Added clog missing for issue 70722 (#73175)
(cherry picked from commit d6670da1d7)
I incorrectly recommended this be set as a warning when it should have been a deprecation.
* Fix deprecation sanity test to not required a collection name when not inside a collection
(cherry picked from commit 8e022ef00a)
Co-authored-by: Sam Doooran <sdoran@redhat.com>
Change:
- Other targets might remove rpm-build as they clean up after
themselves. Ensure that it's present in setup_rpm_repo because
rpmfluff needs it.
Test Plan:
- Local experimentation with yum_repository and mysql_db (the latter of
which depends on a handler which was removing rpm-build) on
stable-2.9.
Signed-off-by: Rick Elrod <rick@elrod.me>
(cherry picked from commit aca5b0e43b)
* Improve setup_rpm_repo
- add handlers to remove repos
- add variable to control whethere or not repos are created
* Use local repo for all distros
* Change repo creation script to module.
(cherry picked from commit 997b2d2a19)
Co-authored-by: Sam Doran <sdoran@redhat.com>
* validate_modules: fails with .id attribute not found
This patch addresses a problem in the `found_try_except_import` test.
This module tries to identify lines like:
`HAS_FOO = True`
In this case, the target (`HAS_FOO`) is of type `ast.Name` and has a
`id` attribute which provide the name.
In my case, I've a line that set a module attribute`. In this case, the
target (`module.var`) has the type `ast.Attribute` and no `id`
attribute. The code trigger an `AttributeError` exception.
This patch ensures we compare a `ast.Name`.
* Update test/lib/ansible_test/_data/sanity/validate-modules/validate_modules/main.py
(cherry picked from commit 7cf80f50d1)
Change:
- Add Ubuntu 20.04 to CI now that venv is default instead of virtualenv in ansible-test.
Test Plan:
- CI
Tickets:
- Fixes#69203
Signed-off-by: Rick Elrod <rick@elrod.me>