Commit Graph

10639 Commits (357714a7c449fd368b910c5b9d1039cc2eb86247)

Author SHA1 Message Date
Matt Clay 357714a7c4 [stable-2.10] Fix ansible-test AZP build lookup.
(cherry picked from commit 877e5b3dfe)

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Matt Clay 369af59c6c [stable-2.10] Remove obsolete Shippable specific scripts.
Also remove some other unncessary code from CI scripts.
(cherry picked from commit be7de9844e)

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Sam Doran b69a23fe0e
[stable-2.10] incidental_setup_rabbitmq test - Use official repo for rabbitmq-erlang (#74452)
Previously it was hosted on bintray, but that service is shutting down on May 1. Using the new
repository also required using a newer version of RabbitMQ..
(cherry picked from commit 62cba4a6ad)

Co-authored-by: Sam Doran <sdoran@redhat.com>
4 years ago
Martin Krizek 316dbd50ed
Prevent ansible_failed_task from further templating (#74290) (#74307)
(cherry picked from commit 664531d7d6)
4 years ago
Matt Clay 768c165a84 [stable-2.10] Fix pypi-test-container port conflict.
(cherry picked from commit cb7f4f1971)

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Martin Krizek 115e5998f4
Actually run blocks/finalized_task test (#74291) (#74311)
(cherry picked from commit 7fecb7ccc3)
4 years ago
Brian Coca 55ad72992d defend against bad or missing crypt (#74304)
* defend against bad or missing crypt

  fixes #74279

(cherry picked from commit 4494ef3a9d)
4 years ago
Matt Davis 768f3d75f9
Map Debian 8 to Python 2 (#74152) (#74360)
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>
4 years ago
Matt Clay cb4209489f
[stable-2.10] Fix ansible-test docker container IP detection.. (#74389)
(cherry picked from commit 14ff5e213c)

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Fernando Correia 0d25d392aa
Detect Homebrew on Mac M1 (Apple Silicon) (#74378) (#74400)
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.
4 years ago
Matt Clay 3d11b480d0
[stable-2.10] Switch to hashlib.sha256() for ansible-test (#72411) (#74169)
When FIPs mode is enable on centos-8, we are not able to load md5
functions.

Signed-off-by: Paul Belanger <pabelanger@redhat.com>
(cherry picked from commit a95213d2f5)

Co-authored-by: Paul Belanger <pabelanger@redhat.com>

Co-authored-by: Paul Belanger <pabelanger@redhat.com>
4 years ago
Sam Doran 19ab9ed7b9
[stable-2.10] ansible-test - ensure trailing separator is added for connection unit test target (#74176) (#74181)
For connection units tests, if the `__init__.py` file is modified, the trailing separator was
not added, making the target invalid.
(cherry picked from commit 7b79b69369)

Co-authored-by: Sam Doran <sdoran@redhat.com>
4 years ago
Matt Clay f5e27ef7ea
[stable-2.10] Add PyPI proxy container for tests on Python 2.6. (#74205)
(cherry picked from commit becf941673)

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Brian Coca 9f74f0663a
Nonfatal facts (#73804) (#73830)
continue with local facts vs at script error
 actually capture execution errors
 better error messages in general
 add more local facts tests

 fixes #52427

(cherry picked from commit 9db557e431)
4 years ago
Brian Coca 1995b1b6e0
find - set proper default based on use_regex (#73961) (#73965)
When using "use_regex: yes" and setting an excludes: without
specifying a pattern: the existing code passes the file-glob '*' to
the regex matcher.  This results in an internal invalid-regex
exception being thrown.

This maintains the old semantics of a default match-all for pattern:
but switches the default to '.*' when use_regex is specified.

The code made sense as-is before excludes: was added (2.5).  In that
case, it made no sense to set use_regex but *not* set a pattern.
However, with excludes: it now makes sense to only want to exclude a
given regex but not specify a specific matching pattern.

Closes: #50067

* moved change to new location
added changelog

* Update lib/ansible/modules/find.py

Co-authored-by: Ian Wienand <iwienand@redhat.com>
(cherry picked from commit 089d0a0508)

* Fix up bad rebase, nuke duplicate "elements:" lines

Signed-off-by: Rick Elrod <rick@elrod.me>
Co-authored-by: Rick Elrod <rick@elrod.me>
Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
Co-authored-by: Sam Doran <sdoran@redhat.com>
4 years ago
Brian Coca 7683dfb727
Fix setup subset (#74022) (#74047)
* fix error msg on bad subset
* added test
* handle more raised but not handled fact exceptions

(cherry picked from commit 4a82e2c486)

* Update fix_setup_bad_subset.yml

Co-authored-by: Rick Elrod <rick@elrod.me>
4 years ago
Brian Coca adae63e053
Fix debug factsetter (#74067) (#74084)
* Fix debug factsetter (#74067)

* prevent debug from setting namespaced facts as tlv
* also added tests

(cherry picked from commit f9f839fa08)

* Update debug_dont_set_facts.yml

Co-authored-by: Rick Elrod <rick@elrod.me>
4 years ago
Brian Coca 69d18e61ed
module output is only json objects (#73765) (#73777)
remove json lists as they are not valid from modules
 fixes #73744

(cherry picked from commit 43300e2279)
4 years ago
Matt Davis 51852557df
add optional module_utils import support (#73832) (#73918)
Treat core and collections module_utils imports nested within any Python block statement (eg, `try`, `if`) as optional. This allows Ansible modules to implement runtime fallback behavior for missing module_utils (eg from a newer version of ansible-core), where previously, the module payload builder would always fail when unable to locate a module_util (regardless of any runtime behavior the module may implement).

* sanity test fixes

(cherry picked from commit 3e1f6484d7)
4 years ago
Sloane Hertel 7ce0b390b2
Fix a bug adding unrelated candidates to the plugin loader redirect_list (#73863) (#73958)
* Add tests for the redirect list

  * test redirect list for builtin module
  * test redirect list for redirected builtin module
  * test redirect list for collection module
  * test redirect list for redirected collection module
  * test redirect list for legacy module

* changelog

(cherry picked from commit 48c0fbd1cb)
4 years ago
Matt Martz f01227ea42
[stable-2.10] Ensure task from the worker is finalized/squashed (#73881) (#73928)
* Ensure task from the worker is finalized/squashed. Fixes #57399. Fixes #49942
(cherry picked from commit 832631b)

Co-authored-by: Matt Martz <matt@sivel.net>
4 years ago
Sam Doran b6b7e0081b
[stable-2.10] find: Specify elements type in paths (#70139) (#73970)
Fixes: #35990

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 87406890cf)

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
4 years ago
Matt Clay 502f7c22d9 [stable-2.10] Fix ansible-test coverage exporting.
ci_complete
ci_coverage
(cherry picked from commit b75844af45)

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Sam Doran e29a78104f [stable-2.10] dnf test - update libmodulemd when updating python3-dnf (#74025)
The dependency version is set too low in the latest version of the package.

https://bugzilla.redhat.com/show_bug.cgi?id=1942236
(cherry picked from commit fa1b52ce55)

Co-authored-by: Sam Doran <sdoran@redhat.com>
4 years ago
Mark Chappell 7ef1a2f830 Ensure unit test paths for connection and inventory plugins are based on the context (#73877) 4 years ago
Brian Coca df5d595984
Don't fail for mixed typed keys (#73726) (#73776)
but warn that content cound not be sorted because of this

* added tests

(cherry picked from commit 527bff6b79)
4 years ago
Abhijeet Kasurde 9a86f8c10e
[2.10][InventoryManager] Fix two unhandled exceptions (#73798)
Change:
- Fix regression: unhandled exception when given inventory directory
  is empty or contains empty subdirectories.
- Fix unhandled exception when limit file is actually a directory
  instead of a file.
- Fix inventory tests which previously could never fail due to missing
  `set -e`. Fixed up tests that failed after `set -e` was added. Added
  several tests.

Test Plan:
- New tests
- Fixed existing tests which previously could never fail

Tickets:
- Fixes #73658

Signed-off-by: Rick Elrod <rick@elrod.me>
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit fa046d302c)

Co-authored-by: Rick Elrod <rick@elrod.me>
4 years ago
Matt Martz 65037d4781
[stable-2.10] Normalize ConfigParser between Python2 and Python3 (#73715) (#73723)
* [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
4 years ago
Sloane Hertel 3e95e3c0a0
galaxy: Handle ignored directory names in role skeleton (#72035) (#73806)
* 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>
4 years ago
Sloane Hertel ece31e1b51
[2.10] find module - stop dir traversal when depth is exceeded (#73808)
* 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
4 years ago
Gonéri Le Bouder b1d278a595
ansible-test: yamllint, check the assigment (#73583)
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)
4 years ago
Alexander Sowitzki ab8bbe269d
[stable-2.10] Let vault lookup output unicode string. (#73571) (#73573)
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>
4 years ago
Gonéri Le Bouder e85732f7e6
[ansible-test] attempt to work around podman (#72096) (#73569)
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>
4 years ago
Brian Coca 2f51105936
only add data when there is data to add (#54559) (#73566)
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)
4 years ago
Sam Doran 77b76a3270
[stable-2.10] Add AlmaLinux to the family of Red Hat-like operating systems (#73541) (#73543)
* 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>
4 years ago
Matt Martz d720a5e42c
[stable-2.10] Don't treat host_pinned as lockstep (#73484) (#73504)
* [stable-2.10] Don't treat host_pinned as lockstep (#73484)

* Don't treat host_pinned as lockstep. Fixes #73364

* Add intg tests.
(cherry picked from commit d3f3784b86)

Co-authored-by: Matt Martz <matt@sivel.net>

* Make non-lockstep callback tests more deterministic (#73511)

(cherry picked from commit 125c220343)
4 years ago
Alicia Cozine c86a498a67
Backport of Split Ansible docs from core docs (#73616) (#73637)
* 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>
4 years ago
Matt Clay b998f7050b
[stable-2.10] Fix ansible-test handling of egg-info. (#73595)
* Add test to verify pkg_resources imports work.

(cherry picked from commit 133a29acb4)

* [stable-2.10] Fix ansible-test handling of egg-info.

Resolves https://github.com/ansible/ansible/issues/67990.
(cherry picked from commit d092356fc5)

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Sam Doran a5f0bc0165 Update signing key used in incidental_setup_flatpak_remote tests
The original key was created using the default expiration time of two years.
Signed the repo again using a key that expires in twenty years.
4 years ago
Matt Clay aedc7301f6
[stable-2.10] Temporary fix for cryptography issues. (#73530). (#73533)
(cherry picked from commit 1a2da990a4)

Co-authored-by: Matt Clay <mclay@redhat.com>
4 years ago
Felix Fontein 5411090f51 Bump antsibull-changelog version for changelog sanity test.
(cherry picked from commit 82cdd7e735)
4 years ago
Sam Doran f9572a377d
[stable-2.10] pause - adjust warning when run in background (#73182) (#73231)
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>
4 years ago
Sam Doran e75570ba83
[stable-2.10] Fix YAML error message when error is at the end of the file (#73241) (#73296)
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>
4 years ago
Brian Coca 3ef061bdc4
Use a pty for local connections (#73023) (#73281)
Fixes #38696

Co-authored-by: James Cammarata <jimi@sngx.net>
(cherry picked from commit 30d93995dd)
4 years ago
Sam Doran 70fb5ae36a
[stable-2.10] facts - properly report virtualization facts for Linux guests on bhyve (#73204). (#73233)
(cherry picked from commit df451636e7)

Co-authored-by: Sam Doran <sdoran@redhat.com>
4 years ago
Brian Coca 9478b59da5
fix inventory source parse error handling (#73160) (#73276)
fixes #51025

added test cases

(cherry picked from commit 1e27d4052a)
4 years ago
Martin Krizek 2c8c02c816
Local vars should have highest precedence in AnsibleJ2Vars (#72830) (#73370)
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 #72262
Fixes #72615

ci_complete

(cherry picked from commit a2af8432f3)
4 years ago
Jordan Borean e41d1f0a3f
no_log mask suboption fallback values and defaults CVE-2021-20228 (#73487) (#73494)
(cherry picked from commit 0cdc410dce)
4 years ago
Rick Elrod 015ec3eda8
git: verify, only use --raw when we need it (#70900) (#73473)
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>
4 years ago
Sloane Hertel 6df8a9ec53
Fix warning for nonexistent inventory cache (#72840) (#73443)
* Fix inventory cache warning by checking if the key exists before loading it

(cherry picked from commit 840bdc1e10)
4 years ago