Commit Graph

11606 Commits (c8de45e5535e43d2872002eef8218aa7d0f461e9)

Author SHA1 Message Date
Felix Fontein 695d3c7927
Bump acme test container. (#79783) (#79815)
(cherry picked from commit 5fb8bc3ddb)
3 years ago
Matt Clay 696b7936a9
[stable-2.13] ansible-test - Specify config path in plugin error (#79881) (#79978)
(cherry picked from commit d48d1c23df)
3 years ago
Matt Clay 522019c317
[stable-2.13] ansible-test - fix warning to include image name (#79560) (#79974)
(cherry picked from commit 0a12d8a5bc)

Co-authored-by: Martin Krizek <martin.krizek@gmail.com>
3 years ago
Jordan Borean 2e541a5450 ansible-test - fix ps argspec check inside cmdlet (#79699)
* ansible-test - fix ps argspec check inside cmdlet

* Added error condition test

* Fix sanity problem

(cherry picked from commit ee33be9484)
3 years ago
Matt Clay 7e7908a3e1 Remove redundant RHEL extras setup. 3 years ago
Matt Clay a76adbccca [stable-2.13] Fix EPEL setup for integration tests on RHEL 7
(cherry picked from commit 1243d2ace0)

Co-authored-by: Matt Clay <matt@mystile.com>
3 years ago
Matt Clay 9e3363f8b7 [stable-2.13] ansible-test - Improve container startup handling.
Also improve the ansible-test-container integration test:

 - Add coverage for the no-probe code path.
 - Add work-arounds for centos6 containers (to support backporting).
 - Avoid systemd debug when the container doesn't use cgroup.
(cherry picked from commit 04fc98c794)

Co-authored-by: Matt Clay <matt@mystile.com>
3 years ago
Matt Clay e6ac16674c [stable-2.13] Add more retries to ansible-test-container test.
(cherry picked from commit f6c0e22f98)

Co-authored-by: Matt Clay <matt@mystile.com>
3 years ago
Matt Clay 55a198da11 [stable-2.13] ansible-test - Support RSA SHA-1 for SSH clients..
(cherry picked from commit 75b60b17ee)

Co-authored-by: Matt Clay <matt@mystile.com>
3 years ago
Matt Clay ad59db8256 [stable-2.13] ansible-test - Fix `--prime-containers` and `--explain` (#79581)
* Remove unused code.
* Fix explain errors.
* Fix `--prime-containers` with docker on cgroup v2.
(cherry picked from commit da3b1d3f50)

Co-authored-by: Matt Clay <matt@mystile.com>
3 years ago
Matt Clay 7783c9b1ee [stable-2.13] ansible-test - Fix target PyPI proxy config..
(cherry picked from commit dcc08eec35)

Co-authored-by: Matt Clay <matt@mystile.com>
3 years ago
Matt Clay 000f3244a4 [stable-2.13] Improve split integration test. (#78738)
* Omit redundant fact gathering.

* Add connection type to split test.

* Add user info to split integration test.
(cherry picked from commit 2e5e802)

Co-authored-by: Matt Clay <matt@mystile.com>
3 years ago
Matt Clay 1d7436935f
[stable-2.13] ansible-test - Improve container management. (#79538)
* ansible-test - More flexible become support.

(cherry picked from commit 5666c6d6a3)

* ansible-test - Add support for more remotes.

(cherry picked from commit 24d91f552c)

* ansible-test - Enable ACLs on FreeBSD remotes.

This allows integration tests to switch from one unprivileged user
to another, sharing files between the users using ACLs.

(cherry picked from commit b63812bc08)

* ansible-test - Enable ACL support on more remotes. (#78299)

(cherry picked from commit 8bb20fe06b)

* ansible-test - Install `acl` on Alpine remotes. (#78303)

(cherry picked from commit 8565deaae3)

* ansible-test - Use sudo for all remotes. (#78310)

(cherry picked from commit f3f4ad9332)

* ansible-test - Fix Ubuntu 20.04 bootstrapping. (#78551)

(cherry picked from commit d683c5bd21)

* ansible-test - Verify executables are executable. (#78606)

(cherry picked from commit ece85abbc4)

* ansible-test - Use --tmpfs to run containers. (#78605)

(cherry picked from commit 4187707f03)

* ansible-test - Remove Fedora 35 support. (#78720)

(cherry picked from commit 38a82a5cc4)

* ansible-test - Fix container error handling. (#78739)

(cherry picked from commit 79f67ed561)

* ansible-test - Improve container management. (#78550)

See changelogs/fragments/ansible-test-container-management.yml for details.

(cherry picked from commit cda16cc5e9)

* ansible-test - Fix container detection. (#79530)

(cherry picked from commit 80d2f8da02)

* Update test matrix symlinks. (#78737)

* Add remote platform symlinks.

These were already supported by ansible-test.
This change adds the symlinks for use in the CI test matrix.

* Remove obsolete AIX test symlink.

AIX was already removed from ansible-test.

(cherry picked from commit 62221a3be2)

* Use patched containers without VOLUME instruction.

* Make test suite compatible with older ansible.

* Fix compatibility with Python 3.8.
3 years ago
sbettid 0dfd6c868e
[stable-2.13] Fix file touch check mode result (backport of #79422) (#79526)
* Fix file touch check mode result (#79360) (#79422)

Fixes #79360

(cherry picked from commit 3936b5c471)

* Rename changelog fragment according to PR number
3 years ago
Sviatoslav Sydorenko 03233e676a
[backport][2.13][PRs #78402 #79289] Enable the `reboot` integration test in CI (#79491)
* Enable the `reboot` integration test in CI

Co-Authored-By: Matt Clay <matt@mystile.com>
(cherry picked from commit bb7ad0f0d8)

* [CI] Move running `reboot` integration test to group 2

PR #79289, follow-up for #78402.

It was breaking the integration-aliases sanity test, but only
became apparent post-merge. This patch fixes that.

(cherry picked from commit 26a4775611)

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
3 years ago
Matt Clay 84695c9158 [stable-2.13] Don't use color in jinja_plugins test.
This should prevent color codes from interfering with string matches.
(cherry picked from commit 31f9d60b8d)

Co-authored-by: Matt Clay <matt@mystile.com>
3 years ago
Matt Clay ea9b9716f0 [stable-2.13] ansible-test - Improve pylint command consistency. (#78896)
* ansible-test - Improve pylint command consistency.

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
(cherry picked from commit bc274f5)

Co-authored-by: Matt Clay <matt@mystile.com>
3 years ago
Sviatoslav Sydorenko 99ff446a3b
[2.13] Log `runme.sh` execution in integration tests (#79283)
* Log `runme.sh` execution in integration tests (#79263)

* Log `runme.sh` execution in integration tests

This patch adds `set -x` where it's missing in the integration tests.
It also enables `pipefail` in `runme.sh` scripts that use pipes.

* Add a change note for PR #79263

(cherry picked from commit 6674c43edd)

* Delete a bad PR #79263 change note

(cherry picked from commit 9cfb3f73e8)
3 years ago
Matt Clay 53f2ef7774 [stable-2.13] ansible-test - Fix and update documentation links..
(cherry picked from commit 938c0fa944)

Co-authored-by: Matt Clay <matt@mystile.com>
3 years ago
Brian Coca 25f8b9829d
mention acl in permissions errors (#79209) (#79251)
as chmod/mode is not the only thing we attempt and Ubuntu not shipping acl
  in newer versions can lead to some confusion

  fixes #79146

(cherry picked from commit 0f18ddca9f)
3 years ago
Matt Martz e0d20bc478
[stable-2.13] Don't assume column index for netmask and broadcast (#79121) (#79133)
* Don't assume column index for netmask and broadcast. Fixes #79117

* fix typo
(cherry picked from commit f53dbf9)

Co-authored-by: Matt Martz <matt@sivel.net>
3 years ago
Sloane Hertel 65fd4e182b
[2.13] ansible-galaxy - fix unnecessary api check when installing role (#79143)
* ansible-galaxy install - fix unnecessary api check when installing a role from git repo (#79090)

* delay server api evaluation until a GalaxyRole needs to make an api call for info, list, and install

(cherry picked from commit cb2e434dd2)

* fix type for older python

* Fix isinstance check (#79159)

Use GalaxyAPI for isinstance check instead of RoleDistributionServer, since the latter is defined in __main__ sometimes (when running integration tests or ansible-galaxy from source) and importing from ansible.cli.galaxy won't reference the same object.

(cherry picked from commit 89d682464b)
3 years ago
Brian Coca a5480c330d
copy, avoid moving non temp remote 'non' files (#79102) (#79155)
* copy, avoid moving non temp remote files that are not dirs/files
fix tests

(cherry picked from commit f66016df0e)
3 years ago
Brian Coca 5dd04e54a8
fix password lookup's use of f=v settings (#76551) (#79108)
* fix password lookup's  use of f=v settings (#76551)

update tests

(cherry picked from commit 5d253a1380)

* fix password unit tests (#79113)

(cherry picked from commit c4d6629bce)

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
3 years ago
Matt Clay a61016fb97 [stable-2.13] Fix ansible-test-git test for newer git versions.
The latest versions of `git` include a fix for CVE-2022-39253. The fix blocks the file protocol by default.

See: 45c9f05c44/Documentation/RelNotes/2.30.6.txt
(cherry picked from commit 4202acb41b)

Co-authored-by: Matt Clay <matt@mystile.com>
3 years ago
Sviatoslav Sydorenko 2d6747bcbf [stable-2.13] Restrict `wheel` below v0.38.0 under Pythons < 3.7 (#79187)
* Restrict `wheel` below v0.38.0 under Pythons < 3.7

* Add a change note for PR #79187

* Update changelogs/fragments/79187--wheel-0.38.0.yml

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

* Use constraints file when installing wheel.

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit a76bbb18a5)

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
3 years ago
Sloane Hertel 45abd5b685
[2.13] apt - fix failure when package is not installed and only_upgrade=True (#78791)
* apt - fix failure when package is not installed and only_upgrade=True (#78781)

* apt - fix module failure when package is not installed and only_upgrade is True

* changelog

(cherry picked from commit 4b45b4b09d)

* apt - fix module short-circuiting when a package is not installed and only_upgrade is True

(cherry picked from commit 14f46845f9)
3 years ago
Sloane Hertel 551ddebeab
[2.13] Limit Galaxy API calls during ansible-galaxy dependency resolution (#78722)
* Limit Galaxy API calls during ansible-galaxy collection dependency resolution when possible

Installing a tarfile with a dependency from a Galaxy server (e.g. dependencies: {'ns.coll': '>=1.0.0'}) does not get the available versions of the dependency from the galaxy server if a sufficient version is already installed.

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
(cherry picked from commit 41b62f7db4)
3 years ago
sbettid 00d60a45fa
[stable 2.13] Fix known host changed status when removing non-existing key #78598 (#78878)
* Fix known_hosts changed status when removing non-existing key (#78748)

* Ensure no change is reported when removing missing key for host with other keys

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

* Add changelog for fix known hosts wrong changed status cherry pick

* Remove old changelog for fix known hosts wrong changed status

* Rename changelog according to PR number

Co-authored-by: Matt Martz <matt@sivel.net>
3 years ago
Matt Clay fa0655228a [stable-2.13] ansible-test - Fix integration test target filter. (#78862)
- Allow disabled, unsupported, unstable and destructive integration test targets to be selected using their respective prefixes.
- Allow unstable tests to run when targeted changes are made and the ``--allow-unstable-changed`` option is specified (resolves https://github.com/ansible/ansible/issues/74213).
(cherry picked from commit d3d7785472)

Co-authored-by: Matt Clay <matt@mystile.com>
3 years ago
Matt Martz cd58c50b97
[stable-2.13] Don't request repo updates when only testing modes (#78843) (#78849)
(cherry picked from commit 2542048)

Co-authored-by: Matt Martz <matt@sivel.net>
3 years ago
Matt Martz 9917b9f9f9
[stable-2.13] wait_for - Read file and perform comparisons using bytes to avoid decode errors (#78317) (#78660)
* wait_for - Read file and perform comparisons using bytes to avoid decode errors. Fixes #78214

* Write non-ascii via script instead of static file

* Use contexlib.closing to support py27 context manager

* Use executable from task, instead of shebang

* Update encoded bytes to utf16
(cherry picked from commit 9d4ced1)

Co-authored-by: Matt Martz <matt@sivel.net>
3 years ago
Sviatoslav Sydorenko 96d0053925
Fix pytest collection during test_host partial run (#78594)
Sometimes pytest errors out with an `ImportError` during its tests
collection stage when a Python package/directory containing the test
module does not have an `__init__.py` in it. This is being observed
under Python 3.9 and higher.

The patch provides a workaround for this problem but does not address
the root cause which is currently unknown.

Ref:
https://github.com/ansible/ansible/pull/78585#issuecomment-1220885431
(cherry picked from commit beb70daf14)
3 years ago
Matt Martz 1cef724544
[stable-2.13] Fix --role-file arg detection (#78475) (#78522)
* Fix --role-file arg detection. Fixes #78204

* Do not traceback, give better error

* Add coverage for compound shortopts to match -r. Fixes #78491
(cherry picked from commit 86298b7)

Co-authored-by: Matt Martz <matt@sivel.net>
3 years ago
Sviatoslav Sydorenko 47d34ce582
Fail fast in stuck `ansible-galaxy-collection` (#78627)
This specific integration test gets stuck periodically causing the
Galaxy jobs to be killed on timeout wasting an hour of runtime. The
module that gets stuck waiting on Pulp is an in-test one, called
`setup_collections`. When it works, the task is complete in around 70
seconds but when it doesn't, it just freezes the whole play.

This patch attempts to make it fail faster by putting a reasonable
timeout value of 2 minutes.

(cherry picked from commit f1c56e988d)
3 years ago
Kate Case f75ecde228
Replace get_persistent_connection_options in task_executor with get_options (#74446) (#78590)
Replace get_persistent_connection_options with get_options
Remove special case for network sub_plugin in _set_plugin_options
Try to avoid mock connection pretending to be persistent
Rename variables->options to reflect what they actually are
Gather options for ssh_type_conn on network_cli
Drop reliance on sub_plugin["type"]

(cherry picked from commit bf1ef5a1f3)
3 years ago
Sloane Hertel 702eadf21b
Fix apt making changes in check mode (#78496) (#78530)
* Don't actually update the cache in check mode

Add tests for updating the cache in check mode

* Don't mark packages as manually installed in check mode and add a test for it

* changelog

* Update test/integration/targets/apt/tasks/apt.yml

* fix test

(cherry picked from commit 3add5e9321)
3 years ago
Sloane Hertel b2553d162d
apt: include apt preferences (e.g. pinning) when selecting packages (#78327) (#78462)
Fixes #77969

(cherry picked from commit 04e8927579)

Co-authored-by: Patrick Hemmer <phemmer@users.noreply.github.com>
3 years ago
Matt Martz 046c59d851
Filter on any Fedora-Cloud-Base image (#78669) 3 years ago
Sviatoslav Sydorenko 8071f014f6
[2.13] Disable `connection_paramiko_ssh` under FreeBSD 13.0 (#78643) 3 years ago
Matt Clay 45b064f3fd
[stable-2.13] Fix file integration test chattr/lsattr check. (#78614) (#78618)
On BusyBox systems such as Alpine, chattr on a tmpfs fails with a status of 0 and output only on stderr.

This change updates the test to not assume output on stdout.

(cherry picked from commit 2e536c0afb)
3 years ago
Matt Clay fd1935048c
Update mypy test. Fix type hints for Python 3.9. (#78587)
This also bumps the minimum controller version (for mypy only) to Python 3.9.

(cherry picked from commit cc5ac88c4c)
3 years ago
Matt Clay d6b40a5bc6
[stable-2.13] ansible-test - Fix ansible-doc sanity test FQCN. (#78518). (#78519)
(cherry picked from commit 2b63fdd1b8)
3 years ago
Matt Clay 9ec6e331bf
[stable-2.13] ansible-test - Fix self-test change handling. (#78521) (#78523)
(cherry picked from commit 99016653a2)
3 years ago
Sloane Hertel 2efb33d200
Fix listing collections that are missing the metadata required by build (#76596) (#78411)
* Rethread pr/70185 through the dependency resolver

Hang optional metadata toggle on the ConcreteArtifactsManager instead of threading it through whole list codepath

Don't error while listing collections if a collection's metadata is missing keys required for building a collection.

Give an informative warning if metadata has been badly formatted.

Co-authored-by: Sam Doran <sdoran@redhat.com>
(cherry picked from commit 05608b20e8)
3 years ago
Sloane Hertel 253c30441b
Fix removing existing dir/files with `ansible-galaxy collection init --force` (#78403) (#78412)
* Remove collection contents when re-initializing with --force

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

(cherry picked from commit a2174fc6d9)
3 years ago
Sloane Hertel d6555399b8
[ansible-galaxy] Fix listing collections with null namespace/name/version metadata (#77014) (#78410)
* Fall back to implicit namespace.name from the path if the metadata is invalid

* Test listing a collection with null namespace/name/version fields in its galaxy.yml

(cherry picked from commit f8ec660e62)
3 years ago
Brian Coca ced2b93697
config error origin (#78407) (#78409)
(cherry picked from commit 9b79d6ba35)
3 years ago
Matt Davis ff4bb5500a
PluginLoader now installs module-to-be-imported in sys.modules before exec (as Python import does). (#78364) (#78367)
(cherry picked from commit 1368bfa348)
3 years ago
Matt Clay 426e4899a3
[stable-2.13] ansible-test - Parse content config only once. (#78418) (#78426)
(cherry picked from commit f2abfc4b3d)
3 years ago
Martin Krizek 2aa3cc9e40
2.13: template module/lookup: fix convert_data for macros (#78259) (#78269)
* template module/lookup: fix convert_data for macros (#78259)

Fixes #78141

(cherry picked from commit 9afdb7fec1)

* Fix templating nested vars with convert_data=False (#78273)

Regression introduced in #78259.

(cherry picked from commit d070b03ad8)
3 years ago
Nicolas Karolak bf1e031eb2
honor use_proxy parameter (#77312) (#78261)
* honor use_proxy parameter
* fix uri test with "use_proxy: no"
* fix urls.py module

Co-authored-by: Carlos <Juan.Carlos.Cardenas.Viera@ibm.com>
(cherry picked from commit 1d9c68d27e)

Co-authored-by: h4rr21 <juankchess13@hotmail.com>
3 years ago
Martin Krizek fc82d215a6
yum: fix releasever for latest (#78066) (#78242)
Fixes #78058

(cherry picked from commit 2bc2153c01)
3 years ago
Matt Martz 70e5673319
[stable-2.13] Fix KeyError for ansible-galaxy when caching paginated responses from v3 (#78325) (#78405)
* Fix KeyError for ansible-galaxy when caching paginated responses from v3

* changelog

* generate responses in loop for test

Co-authored-by: Matt Martz <matt@sivel.net>
(cherry picked from commit 5728d72)

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
3 years ago
Matt Clay 24359537bb [stable-2.13] ansible-test - Fix TTY and output handling. (#78350).
(cherry picked from commit a3c90dd0bc)

Co-authored-by: Matt Clay <matt@mystile.com>
3 years ago
Matt Clay 4bb1907084 [stable-2.13] ansible-test - Fix handling of args after `--` (#78328)
(cherry picked from commit 0012263c7a)

Co-authored-by: Matt Clay <matt@mystile.com>
3 years ago
Matt Clay e806c4e64d
[stable-2.13] Refactor ansible-test integration tests. (#78168) (#78362)
* Relocate update-ignore.py for easier re-use.

* Add script to ease collection testing.

* Skip ignore rewrite if file does not exist.

* Add integration test for the shebang sanity test.

* Fix ansible-test-no-tty integration test.

Previously the test only verified a TTY was not used if a TTY already existed.
This prevented the test from verifying behavior when run in CI.
Now the test creates a PTY before invoking ansible-test.

* Clean up ansible-test-docker integration test.
(cherry picked from commit f70cc2fb7e)

Co-authored-by: Matt Clay <matt@mystile.com>
3 years ago
Sviatoslav Sydorenko 3cffcfda9b
Drop custom repo from libuser install @ Alpine CI (#78305) (#78306)
`group` and `setup_cron` integration tests currently install `libuser` and `faketime`
packages respectively, from the non-default edge/testing repositories. It is no
longer necessary to do so for the former so this patch drops the repo option. As
for the latter, this patch includes a note explaining when the same could be done
for it too.

This patch also adds a note on installing `faketime` on Alpine in CI.

(cherry picked from commit 619a1fa7e2)
3 years ago
Brian Coca 69562a8db6
Fix wording for :ref|term: substitution (#78216) (#78221)
* Fix workding for :ref|term: subsitution

 now matches 'seealso' and makes more sense:

  ```
  delay:
  applies_to:
  - Task
  description: Number of seconds to delay between retries. This setting is only used
    in combination with `until`.
  ```
 vs
  ```
  delay:
  applies_to:
  - Task
  description: Number of seconds to delay between retries. This setting is only used
    in combination with website for `until`.
  ```

* updated unit tests

* match see also

* more sanity

(cherry picked from commit d26801e994)
3 years ago
Brian Coca 3ef4609bca
password lookup argument parsing fix (#78080) (#78102)
fixes #78079

(cherry picked from commit cea18bf60a)
3 years ago
Martin Krizek 6468bb0cb6
Move undefined check from concat to finalize (#78165) (#78179)
In the classic Jinja2's Environment str() is called on the return value of the
finalize method to potentially trigger the undefined error. That is not
the case in NativeEnvironment where string conversion of the return value is
not desired. We workaround that by checking for Undefined in all of our concat
functions. It seems simpler to do it earlier in the finalize method(s) instead.
As a side-effect it fixes an undefined variable detection in imported templates.

Fixes #78156

ci_complete

(cherry picked from commit 17d52c8d64)
3 years ago
Sloane Hertel d4cd1853b0
Make unit test for missing git executable more generic (#78173) (#78174)
* Make unit test for missing git executable more generic

* use MagicMock side_effect to raise exception instead

(cherry picked from commit 1562672bd1)
3 years ago
Matt Clay 99217ca2b6 [stable-2.13] ansible-test - Improve pip bootstrap download.
(cherry picked from commit b9d13d222c)

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Sandra McCann f09e6b7769
Backportapalooza 06 16 (#78072)
* Docsite: Updated style guide resources (#78048)

(cherry picked from commit 561cf1956d)

* Create reusable role layout snippet for documentation (#78057)

* reuse role structure
* reuse role snippet in role docs

(cherry picked from commit f4ad1c771e)

* Docsite: update links to community docs (#78043)

(cherry picked from commit 46d86a882d)

* Windows - incorrect python-devel package in WinRM docs (#78037)

Co-authored-by: Emanuele Barbato <manu@Giuseppes-MacBook-Air.local>
(cherry picked from commit 681dc6eab9)

* issue #72449 winrm script rm (#77931)

(cherry picked from commit 3cd2c494bd)

* reword the regex note (#75393)

Co-authored-by: Matt Martz <matt@sivel.net>
Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>
(cherry picked from commit 66c0882314)

* Document debconf interaction with dpkg-reconfigure (#74196)

Signed-off-by: David Greaves <david@dgreaves.com>
(cherry picked from commit 5b90601ca4)

Co-authored-by: Lewis Brogan <ilewisbrogan@gmail.com>
Co-authored-by: Andrew Klychkov <aklychko@redhat.com>
Co-authored-by: Emanuele Barbato <30394740+emanuelebarbato@users.noreply.github.com>
Co-authored-by: Don Naro <dnaro@redhat.com>
Co-authored-by: David Greaves <david@dgreaves.com>
4 years ago
Sloane Hertel cf5c0c9b06
ansible-galaxy - support resolvelib versions >= 0.5.3, < 0.9.0 (#77649) (#78008)
* ansible-galaxy - support resolvelib versions >= 0.5.3, <= 0.8.1

Test incompatibilities are removed for resolvelib >= 0.6.0

Test against the latest 0.8.x version and fix requirements

* Fix tests - use a venv for testing the range of resolvelib versions

* Update temporary hardcoded fallback for ansible-test

* Update hardcoded upperbound for sanity tests

* Make error check more flexible

(cherry picked from commit 143e7fb45e)
4 years ago
Sloane Hertel 977c2480db
[2.13] Fix ansible-galaxy traceback when unexpected version of resolvelib is installed (#77901)
* Fix ansible-galaxy traceback when unexpected version of resolvelib is installed (#77630)

* Fix traceback when a supported version of resolvelib is not installed

Try to read the supported version range from the package distribution info and fall back to a hardcoded lowerbound/upperbound (>=0.5.3,<0.6.0).

* Add tests for unsupported resolvelib versions

* Resolve remaining import sanity test issues.

Co-authored-by: Matt Clay <matt@mystile.com>
Co-authored-by: Matt Martz <matt@sivel.net>
(cherry picked from commit 82f3a57bee)

* Fix boolean condition so that ansible-galaxy collection install works when a valid resolvelib is installed. (#77906)

(cherry picked from commit 6fbc8bd2bc)

* ansible-galaxy - ensure variable is defined for any error when getting the ansible-core distribution (#77993)

(cherry picked from commit db335498d0)

Co-authored-by: Felix Fontein <felix@fontein.de>
4 years ago
Brian Coca be9c208cb4
apt: fix virtual package install version detection (#76781) (#77909)
* apt: fix virtual package install version detection

Change 4a62c4e3e4 introduced version
matching in installation.

The problem stems from

 if version_installable or version:
     pkg_list.append("'%s=%s'" % (name, version_installable or version))

When the package is a virtual-package, package_status() is returning
the "version_installable" of the package *satisfying* the
virtual-package; but then this is trying to install the
virtual-package with this version pin.

For example, "yaml-mode" is a virtual package satisifed by
"elpa-yaml-mode" (currently 0.0.14-1) and trying to install it fails
with

 $ usr/bin/apt-get -y ... install 'yaml-mode=0.0.14-1'
 ... failed: E: Version '0.0.14-1' for 'yaml-mode' was not found ...

In the case of a virtual-package with nothing installed to satisfy it,
we should just return blank values to allow apt-get to do it's thing.

The tests are updated to install and remove this package.

Fixes: #76779
(cherry picked from commit e4c0bbf885)

Co-authored-by: Ian Wienand <iwienand@redhat.com>
4 years ago
Sloane Hertel 63a0860231
Add toggle to fix module_defaults with module-as-redirected-action on a per-module basis (#77265) (#77899)
* If there is a platform specific handler, prefer the resolved module over the resolved action when loading module_defaults

Add a toggle for action plugins to prefer the resolved module when loading module_defaults

Allow moving away from modules intercepted as actions pattern

Fixes #77059

(cherry picked from commit 621e782ed0)
4 years ago
Joseph Torcasso e5e3bc849d
template/__init__.py - fix KeyError when wantlist=False with non-list (#77824)
(cherry picked from commit c9ce7d08a2)
4 years ago
Matt Davis 9796d055b9
fix SELinux facts tests (#77707)
* make the pre-flight sniffing more robust to different failure conditions (was failing on Ubuntu 22.04 VMs)
* remove skip aliases (the test needs to function everywhere to assert that the selinux facts bits behave properly when it's N/A)

(cherry picked from commit 4ff10fcd31)
4 years ago
Brian Coca f02e870b1b
dont rely on path to set config defs for plugins (#77659) (#77694)
(cherry picked from commit a3cc6a581e)
4 years ago
Sloane Hertel f026e3dcf9
Fix 'ansible-config dump --only-changed -t all' verbosity (#77898) (#77922)
* Fix 'ansible-config dump --only-changed -t all' to only display headers if plugin options are changed

* changelog

* add a test

(cherry picked from commit 1214b63f4f)
4 years ago
Sloane Hertel 0c76edb63a
Pin PyYAML version compatible with Python 3.8+ (#77936) (#77986)
Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit e89176caac)
4 years ago
Sloane Hertel 68c2f09ae8
[2.13] fix ansible-galaxy-collection integration test (#77992)
* ansible-galaxy-collection - use --pinentry-mode loopback for gpg key revocation (#77967)

(cherry picked from commit 1706d35fc4)

* fix ansible-galaxy-collection test with revoked key (#77989)

* Remove unnecessary gpg passphrase

(cherry picked from commit a43112290a)
4 years ago
Matt Clay 567a295c00
[stable-2.13] ansible-test - Adjust unit test mock usage. (#77961) (#77999)
(cherry picked from commit 23914d3f0b)

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Matt Clay ae380e3bef
[stable-2.13] ansible-test - Multiple backports (#77951)
* ansible-test - Backport `InternalError`

NOTE: This is a partial backport, including only one new class.

(cherry picked from commit b960641759)

* ansible-test - Fix subprocess management. (#77641)

* Run code-smell sanity tests in UTF-8 Mode.
* Update subprocess use in sanity test programs.
* Use raw_command instead of run_command with always=True set.
* Add more capture=True usage.
* Don't expose stdin to subprocesses.
* Capture more output. Warn on retry.
* Add more captures.
* Capture coverage cli output.
* Capture windows and network host checks.
* Be explicit about interactive usage.
* Use a shell for non-captured, non-interactive subprocesses.
* Add integration test to assert no TTY.
* Add unit test to assert no TTY.
* Require blocking stdin/stdout/stderr.
* Use subprocess.run in ansible-core sanity tests.
* Remove unused arg.
* Be explicit with subprocess.run check=False.
* Add changelog.
* Use a Python subprocess instead of a shell.
* Use InternalError instead of Exception.
* Require capture argument.
* Check for invalid raw_command arguments.
* Removed pointless communicate=True usage.
* Relocate stdout w/o capture check.
* Use threads instead of a subprocess for IO.

(cherry picked from commit 5c2d830dea)

* ansible-test - Add support for remote Ubuntu VMs.

(cherry picked from commit 6513453310)

* ansible-test - Fix remote completion validation.

(cherry picked from commit e2200e8dfc)

* ansible-test - Add multi-arch remote support.

(cherry picked from commit 2cc74b04c4)

* ansible-test - Enhance the shell command. (#77734)

* ansible-test - Add shell --export option.

* ansible-test - Support cmd args for shell command.

Also allow shell to be used without a valid layout if no delegation is required.

* ansible-test - Improve stderr/stdout consistency.

By default all output goes to stdout only, with the exception of a fatal error.

When using any of the following, all output defaults to stderr instead:

* sanity with the `--lint` option -- sanity messages to stdout
* coverage analyze -- output to stdout if the output file is `/dev/stdout`
* shell -- shell output to stdout

This fixes issues two main issues:

* Unpredictable output order when using both info and error/warning messages.
* Mixing of lint/command/shell output with bootstrapping messages on stdout.

* ansible-test - Add changelog fragment.

(cherry picked from commit fe349a1ccd)

* ansible-test - Fix remote args restriction.

The platform-specific and global fallbacks were not working with the `--remote` option.

This regression was introduced by https://github.com/ansible/ansible/pull/77711

(cherry picked from commit 76ead1e768)
4 years ago
Sandra McCann f3b56ec661
Backportapalooza 06 02 (#77960)
* docs: update porting guide for ansible 6.0.0b1 (#77913)

(cherry picked from commit 7c89562580)

* docs: add missing notes in porting guide for 6.0.0b1 (#77926)

There was an issue with the changelog in community.network 4.0.0, it's
been fixed in 4.0.1 and now properly included.

(cherry picked from commit 9f7956ba30)

* Remove platform dev guides from core docs (#77915)

(cherry picked from commit f3c684564c)

* Migrate community.vmware Dev Guide to collection (#77723)

(cherry picked from commit b69eb28ed2)

* Issue #77681 revamp getting started guide (#77897)

(cherry picked from commit 89e4fb71e6)

* ssh retry docs addition (#77930)

(cherry picked from commit 15750aec52)

* fix: update button text to "Load token" (#77925)

(cherry picked from commit 16e0d4a121)

* fix bad merge conflict resolution

Co-authored-by: David Moreau Simard <moi@dmsimard.com>
Co-authored-by: Mario Lenz <m@riolenz.de>
Co-authored-by: Don Naro <dnaro@redhat.com>
Co-authored-by: Dan Kolepp <10145457+dkolepp@users.noreply.github.com>
4 years ago
Matt Clay 2ac74197af [stable-2.13] ansible-test - Prefer unittest.mock for core.
(cherry picked from commit 81351022d8)

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Matt Clay 44ce9fe998 [stable-2.13] ansible-test - Fix shell target options handling.
(cherry picked from commit f933314101)

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Matt Clay 2b6df9ea36
Add RHEL 9.0 to ansible-test and CI. (#77923)
* ansible-test - Add RHEL 9.0 remote support.

* Add RHEL 9.0 to CI. (#77853)

* Add RHEL 9.0 to CI.

* Restrict network manager inspection to RHEL8

* Skip module tests when astream_name is undefined, undefine it for RHEL9 until 9.1

* Remove redundant test.

Co-authored-by: Matt Martz <matt@sivel.net>
(cherry picked from commit 43d650f924)

* Include test fix from https://github.com/ansible/ansible/pull/77847
4 years ago
Sandra McCann e6b16ddeb5
Docs backportapalooza 05 26 (#77921)
* Remove statement about dependencies and includes. Fixes #75055 (#77912)

(cherry picked from commit a2eb472fb6)

* doc: Clarify stride/increment in inventory intro (#77893)

(cherry picked from commit 9010f0fbe3)

* Remove double spaces in errormessage (#77839)

(cherry picked from commit 711b51fad6)

* add anchors for crossreferencing (#77800)

(cherry picked from commit a99623bce1)

* [docs]Mention that global variables are not mapped to hostvars (#77783)

(cherry picked from commit 74469bf54a)

* Point to Kerberos as a safer winrm setup method (#77794)

(cherry picked from commit 45d930e9c1)

* more context on multiple facts modules (#77896)

(cherry picked from commit dbbeea0686)

Co-authored-by: Matt Martz <matt@sivel.net>
Co-authored-by: rawtaz <rawtaz@users.noreply.github.com>
Co-authored-by: Wouter Schoot <wouter@schoot.org>
Co-authored-by: Sergei Petrosian <30409084+spetrosi@users.noreply.github.com>
Co-authored-by: TheBigBear <TheBigBear@users.noreply.github.com>
Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
4 years ago
Matt Clay 46a1eb6832 [stable-2.13] Prefer unittest.mock over mock. (#77886)
(cherry picked from commit 2595b42aca)

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Matt Clay 47e1cc38fd [stable-2.13] Use unittest.mock instead of mock. (#77883)
This can only be done for controller tests.
(cherry picked from commit 3a9a23fb1a)

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Matt Clay 93b8ccda21 [stable-2.13] Avoid deprecated method in unit tests.
(cherry picked from commit 5f74350fd5)

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Martin Krizek 89e6dcda26
Prevent losing unsafe from lookups (#77609) (#77650)
* Prevent losing unsafe from lookups

This patch fixes a bug which under certain conditions results in data
returned from lookups not being marked as unsafe.

Each time Templar.do_template is invoked a new AnsibleContext is
created and stored effectively at two places:
1) as an instance variable in templar_obj.cur_context
2) as a local variable called new_context in do_template method of Templar

Due to custom functionality in Ansible's Context that allows for nested
templating it is possible that during resolving variable's value
template/do_template method is called recursively again, again creating
a new context. At that point the problem manifests itself because as
mentioned in 1) above the context is overwriten on the templar object
which means that any subsequent calls to _lookup will use the new
context to mark it as unsafe which is now different to the local
new_context which is used for testing for unsafe property.

The solution to the problem appears to be to restore the original
context inside do_template and also to eliminate the local variable
new_context to prevent problems in the future.

It appears that we don't have a better way of storing the context other
than as some form of global variable and so this appears to be the
"best" solution possible at this point. Hopefully data tagging will be
the solution here.

For more examples see unit and integration tests included in this patch.

Fixes #77535

(cherry picked from commit 3980eb8c09)
4 years ago
Matt Clay 9a7b645c50 ansible-test - Update default containers to 5.9.0. 4 years ago
Felix Fontein cad892125c [stable-2.13] Replace antsibull with antsibull-docs (#77504)
(cherry picked from commit 841bdb74eb)

Co-authored-by: Felix Fontein <felix@fontein.de>
4 years ago
Sam Doran 91fb18bf31
[stable-2.13] arg_spec - Return aliases in validation result and update aliases (#77576) (#77601)
When looking up the `no_log` setting for a parameter that is an alias in
`AnsibleModule._log_invocation()`, the alias value will always be an
empty dictionary since `self.aliases` on the `AnsibleModule` instance is
never updated after initialization. Since the `no_log` setting is on the
canonical parameter not the alias, an incorrect warning is issued if the
parameter matches `PASSWORD_MATCH`.

This PR returns the aliases dictionary as an attribute of the
`ValidationResult` and updates the `aliases` attribute on the
`AnsibleModule` instance.
(cherry picked from commit 1b947eaf92)

Co-authored-by: Sam Doran <github@samdoran.com>
4 years ago
Sloane Hertel 2cba3e8c42
Get git executable for collections in git repos (#77493) (#77500)
* Fix traceback installing collections from git repos if git is not installed

(cherry picked from commit 477c55b0d2)
4 years ago
Matt Martz 30f96bb75e
[stable-2.13] ansible-test - Don't fail if network cannot be disconnected (#77472) (#77482)
* Don't fail if network cannot be disconnected

* add clog frag
(cherry picked from commit 66c5844)

Co-authored-by: Matt Martz <matt@sivel.net>
4 years ago
Matt Clay 3b20b02272
[stable-2.13] Fix sanity test crash. (#77475)
(cherry picked from commit 6216c9fc93)

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
4 years ago
Jordan Borean f720c58949
winrm - ensure callers PATH for kinit is set (#77401) (#77404)
* winrm - ensure callers PATH for kinit is set

* Fix unit test expectations

* Fix type annotation

(cherry picked from commit 60b4200bc6)
4 years ago
Matt Martz 85341c3e5d
[stable-2.13] Catch ImportError when pyyaml doesn't have libyaml extension (#77434) (#77459)
* [stable-2.13] Catch ImportError when pyyaml doesn't have libyaml extension (#77434)
(cherry picked from commit e3aa73c)

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

* Add test to assert that missing libyaml doesn't result in an error. Fixes #77437

(cherry picked from commit 2797dc644a)
4 years ago
Matt Clay ee9705a1ce [stable-2.13] ansible-test - Fix origin host target filtering.
(cherry picked from commit 4b51e61645)

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Matt Clay 708e4c206a ansible-test - Update default test containers. 4 years ago
Felix Fontein 7075fa36a1
Bump requirements for antsibull to 0.42.0 (which depends on antsibull-changelog >= 0.14.0). (#77362) 4 years ago
Matt Martz 4723eb9caa
Add family fallback for RHEL to register as RedHat (#77371)
* Add family fallback for RHEL to register as RedHat

* Update tests to properly assert RHEL behavior
4 years ago
Felix Fontein babc26adc1
Handle errors during ansible-doc --metadata-dump more gracefully (#77035)
* Add option --no-fail-on-errors to return errors for ansible-doc --metadata-dump in JSON result instead of failing.

* Adjust changelog fragment.

* Add basic tests.
4 years ago
Matt Clay 55f90ba31f ansible-test - Remove RHEL 9.0b support.
Support can be restored once RHEL 9 has been released.
4 years ago
Matt Martz afecc6400e
Action Plugin argspec validation (#77013) 4 years ago