Commit Graph

5188 Commits (dfe3a4d345ef236cabb79d2d91ef0640ea8b3a70)

Author SHA1 Message Date
Sam Doran 4b23ac77e1 Disable failing hcloud_server test 5 years ago
Sam Doran 0d668b6046
[stable-2.9] find - set proper default based on use_regex (#73961) (#73966)
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)

Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>

* Update fix_find_default.yml

Co-authored-by: Rick Elrod <rick@elrod.me>
5 years ago
Matt Davis f8caa43dc7
add optional module_utils import support (#73832) (#73916)
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

ci_complete

(cherry-picked from 3e1f6484d7)
5 years ago
Matt Martz 1592c8b0fd
[stable-2.9] Ensure task from the worker is finalized/squashed (#73881) (#73929)
* 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>
5 years ago
Sam Doran 21eac8aba4 Move file needed by cs_volume test to S3
There is a bad mirror missing the file and it is causing tests to fail.
5 years ago
Rhys d0703a8c7d
Update mongodb replicaset check_compatibility function (#72299)
* Update check_compatibility function
5 years ago
Felix Fontein 68f32e43c1
Backport of https://github.com/ansible-collections/community.docker/pull/88 to stable-1. (#73816) 5 years ago
Matt Martz 4c503fe3b1
[stable-2.9] Don't treat host_pinned as lockstep (#73484) (#73513)
* [stable-2.9] 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)
5 years ago
Felix Fontein fc4c154a8e
Backport of 8702713ac3 (#73638) 5 years ago
Matt Martz 0d20c829a2
[stable-2.9] Normalize ConfigParser between Python2 and Python3 (#73715) (#73724)
* [stable-2.9] 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 950ab74758)

Co-authored-by: Matt Martz <matt@sivel.net>
5 years ago
Sam Doran 5a9f4f7bb3 Move win_uri to a group that does not reboot the test instance
Another test in group3 reboots the test instance, killing the ssh connections
needed for access to the httptest container.

ci_complete
5 years ago
Sam Doran 733704f97e Rebalance Windows test groups to avoid timeouts 5 years ago
Sam Doran 55a3f2e1eb 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.
5 years ago
Ashwini Mhatre 67e0d9a481
[stable-2.9]:Fix IOSXR integration test (#73607)
* Fix integration testcase in netconf_config for iosxr
5 years ago
Rick Elrod 83fc193cb6
[mongodb tests] Wait for ports in TIME_WAIT (#73655)
Change:
- The latest mongodb we install causes processes to not die correctly
  (they end up as zombies), and this causes the ports they listen on to
  be held in TIME_WAIT. We need to wait for them to fall out of
  TIME_WAIT before we can continue and use them again.

Test Plan:
- CI
- Local playing in containers

Signed-off-by: Rick Elrod <rick@elrod.me>
5 years ago
Andrew Klychkov 069311bff3
postgresql_query: fix datetime.timedelta type handling (#73520) 5 years ago
Jordan Borean 49ebd509df
no_log mask suboption fallback values and defaults CVE-2021-20228 (#73487) (#73493)
(cherry picked from commit 0cdc410dce)
5 years ago
Rick Elrod d268891703
[setup_rpm_repo test] Ensure rpm-build is present (#73516) (#73515)
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)
5 years ago
Sam Doran e3c08d001d
[stable-2.9] pause - adjust warning when run in background (#73182) (#73230)
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>
5 years ago
Andrew Klychkov 2b217c9c9b
postgresql_set: Return a message when a passed parameter has not been found (#73286)
Co-authored-by: Andrew Klychkov <andrew.klychkov@gmail.com>
5 years ago
Martin Krizek 65fdc41fb1
Local vars should have highest precedence in AnsibleJ2Vars (#72830) (#73369)
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)
5 years ago
Andrew Klychkov 6f4ea2f19e
postgresql_query: fix decimal handling (#73414)
Co-authored-by: Andrew Klychkov <andrew.klychkov@gmail.com>
5 years ago
Sloane Hertel d8a82154d4
[2.9] Fix warning for nonexistent inventory cache (#72840) (#73444)
* Fix inventory cache warning by checking if the key exists before loading it

(cherry picked from commit 840bdc1e10)
5 years ago
Sam Doran 474044b10d [stable-2.9] Make yum_repository test more reliable (#73467)
* 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>
5 years ago
Sloane Hertel 6065dfb291
[2.9] Pass the top level dictionaries to combine_vars (#72979) (#73147)
combine_vars uses dict.update() to replace keys

(cherry picked from commit 5e03e322de)

* Add tests for merging and replacing vars from inventory sources (#73181)

(cherry picked from commit 9de2da8a7e)
5 years ago
Sam Doran 65367b9721
[stable-2.9] user - properly handle password and password lock when used together (#73016) (#73178)
Do the right thing on Linux when password lock and a password hash are provided by writing
out the password hash prepended by the appropriate lock string rather than using -U and -L.
This is the correct way to set and lock the account in one command.

On BSD, run separate commands as appropriate since locking and setting the password cannot
be done in a single action.

FreeBSD requires running several commands to get the account in the desired state. As a result,
the rc, output, and error from all commands need to be combined and evaluated so an accurate
and complete summary can be given at the end of module execution.

* Improve integration tests to cover this scenario.
* Break up user integration tests into smaller files
* Properly lock account when creating a new account and password is supplied

* Simplify rc collection in FreeBSD class
  Since the _handle_lock() method was added, the rc would be set to None, which could make
  task change reporting incorrect. My first attempt to solve this used a set and was a bit too
  complicated. Simplify it my comparing the rc from _handle_lock() and the current value of rc.

* Improve the Linux password hash and locking behavior
  If password lock and hash are provided, set the hash and lock the account by using a password
  hash since -L cannot be used with -p.

* Ensure -U and -L are not combined with -p since they are mutually exclusive to usermod.

* Clarify password_lock behavior..
(cherry picked from commit 264e08f21a)

Co-authored-by: Sam Doran <sdoran@redhat.com>
5 years ago
Richard Megginson 7eb1703740
backport support for python-kubernetes v12 to ansible 2.9 (#72792)
Support for using python-kubernetes v12 has been added to the
new upstream repo:
https://github.com/ansible-collections/community.kubernetes/blob/main/plugins/module_utils/common.py#L256-L261
This PR backports that support to ansible 2.9
5 years ago
Felix Fontein 5a92beb575
Fix freeform actions with FQCN. (#72958) 5 years ago
Felix Fontein c73de6f0b3
[stable-2.9] Fix docker_image tests (#72953)
* Backport of https://github.com/ansible-collections/community.docker/pull/47 to stable-2.9.

* Also fix old-options.
5 years ago
Felix Fontein 77ae0819f9
Backport of 5eef093e99 (#73067) 5 years ago
Sam Doran f7ac5ea8d6
[stable-2.9] systemd - do not overwrite unit name when searching (#72985) (#73014)
* systemd - do not overwrite unit name when searching

PR #72702 introduced a bug that changed the unit name when splitting it up for the purpose
of searching for the unit. This only happens on unit file templates on systems that have a 5.8
or newer kernel and a version of systemd that does not contain a bugfix that causes systmed
to fail to parse dbus.

* Use facts rather than a manual probe to determine if systmed is present

* Remove unnecessary block

* Use vars files instead of set_fact

* Add tests for using a templated unit file

* Update changelog fragment

* Use template to get correct path to sleep binary

(cherry picked from commit 48803604cd)
5 years ago
Sam Doran 98eb810f7d
[stable-2.9] Remove exit code from traps in tests (#72969)
Having the trap exit with a specific code will override
the exit code that caused the trap to run, which could
mask errors
(cherry picked from commit 5157a92139)

Co-authored-by: Sam Doran <sdoran@redhat.com>
5 years ago
Matt Martz ead63f2021
[stable-2.9] Fix reset_connection paramiko, winrm, psrp (#72688) (#72926)
* Ensure we only reset the connection when one has been previously established. Fixes #65812

* Ensure psrp doesn't trace

* winrm too

(cherry picked from commit a3b6485073)

Co-authored-by: Matt Martz <matt@sivel.net>
5 years ago
Matt Martz c32371db56
[stable-2.9] Fix async interpreter parsing (#72636) (#72924)
* Fix async interpreter parsing. Fixes #70690
* Target localhost instead of remote host
* Don't forget inventory
* Address shellcheck issue
(cherry picked from commit 83764ad)

Co-authored-by: Matt Martz <matt@sivel.net>
5 years ago
Felix Fontein 0f65b901f7
docker_image: always push, also when tagging is not necessary
Backport of 117f132213 (#73066)
5 years ago
Sam Doran 95f65b9249
[stable-2.9] Fix string/bytestring comparsion in m_u.basic (#70439) (#73130)
Change:
- module_utils.basic.is_special_selinux_path() used a string ==
  bytestring comparison which returned False and made Ansible think that
  certain filesystems aren't, in fact, special-cased, when they should
  be. Ensure both sides of the == are bytestrings.

Test Plan:
- Added `copy` integration tests for this case.

Tickets:
- Fixes #70244

Signed-off-by: Rick Elrod <rick@elrod.me>.
(cherry picked from commit 688cd8657b)

Co-authored-by: Rick Elrod <rick@elrod.me>
5 years ago
Sam Doooran bb7c0326d8 [stable-2.9] Constrain pexpect and ptyprocess (#73109)
The recent update of ptyprocess to 0.7.0 is incompatible with Python 2.6 and
is causing test failures.

* Add setup_pexpect role to expect test
(cherry picked from commit 003a9e890d)

Co-authored-by: Sam Doooran <sdoran@redhat.com>
5 years ago
Brian Coca c4844e992c
make collection callbacks follow normal flow (#59932) (#72228)
* make collection callbacks follow normal flow (#59932)

make collections whitelist follow normal flow

* fixes missing set_options call and adhoc and stdout processing rules
* avoid dupes
* fixed to handle redirects
* also updated tests with new and more accurate skip message
* fix callback tests for envs with cowsay installed
* lots MOAR comments on why the code is as it is, some todos to refactor in future

Co-authored-by: Matt Davis <nitzmahone@users.noreply.github.com>
(cherry picked from commit 5ec53f9db8)

* fixed bad merge

* hack in redirected names

* ensure we run additional calblacks
5 years ago
Brian Coca ce52e6738c
remove redundant remote_user for local setting (#72508)
* remove redundant remote_user for local setting

  local action plugin already does and this also should fix
  fork/thread issue by removing use of pwd library

  fixes #59642

(cherry picked from commit 488b9d6c35)

* ensure local exposes correct user (#72543)

* ensure local exposes correct user

  avoid corner case in which delegation relied on
  playcontext fallback which was removed

  fixes #72541

(cherry picked from commit aa4d53ccdf)
5 years ago
Jordan Borean ff364b6541
Disable win_rds* tests in CI (#72890) 5 years ago
Rick Elrod 8eaa7423d4
[2.9] [cloud_init_data_facts tests] fix for centos8 (#72886)
Change:
- `udev` is provided by `systemd-udev`, which our `state=present` check
  doesn't match. For now, work around this so we don't end up trying to
  upgrade all of systemd.
- In the future, we should discuss if the `yum` module does the right
  thing here.

Test Plan:
- Locally in docker
- CI

Signed-off-by: Rick Elrod <rick@elrod.me>
5 years ago
Sam Doran cc47d9cb41
[stable-2.9] wait_for - ignore psutil related errors (#72401) (#72407)
When enumerating connections with psutil, catch and ignore errors to avoid returning a stack trace.

Co-authored-by:  Matt Martz <matt@sivel.net>
(cherry picked from commit fb09fd2a23)
5 years ago
Felix Fontein aa471096de
[2.9] Fix missing ansible.builtin FQCNs in hardcoded action names (#72458)
* Fix missing ansible.builtin FQCNs in hardcoded action names (#71824)

* Make sure hard-coded action names also check for FQCN.
* Use _add_internal_fqcn() to avoid hardcoded lists and typoes.

(cherry picked from commit da60525610)

ci_complete

* Replace some more FQCNs.

(cherry picked from commit 72302dd611)

* Fix another case which was already fixed in stable-2.10.
5 years ago
Sam Doran 74ec5ab6b5
[stable-2.9] pause - do not hang if run in the background (#72065) (#72606)
* Consolidate logic for determining whether or not session is interactive
  into a single function, is_interactive()
* Increase test coverage

I wasn't able to find a good way of simulating running a backgrounded test with CI since the
whole test is essentially run not in a TTY, which is similar enough to cause the new is_interactive()
function to always return false.
(cherry picked from commit 4b8cb6582b)

Co-authored-by: Sam Doran <sdoran@redhat.com>
5 years ago
Sam Doran ddf44ddd46
[stable-2.9] AnsibleModule.set_mode_if_different: handle symlink is in a sticky directory (#45198) (#72862)
* file: add symlink is in a sticky directory tests
* file: handle symlink in a sticky directory

The builtins import was removed since it was unused, but it is now needed.
(cherry picked from commit b464d18fd1)

Co-authored-by: Pilou <pierre-louis.bonicoli@libregerbil.fr>
Co-Authored-By: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
5 years ago
Nathaniel Case a4ba6ace01
Update ssh connection play_context alongside network_cli's (#72185)
Backport of https://github.com/ansible-collections/ansible.netcommon/pull/135

* Fix iosxr tests
5 years ago
Rick Elrod 82ba44871a
fix resource name in aws_codepipeline too (#72825)
Signed-off-by: Rick Elrod <rick@elrod.me>
5 years ago
Matt Clay 87662c5d59 Fix resource name. 5 years ago
Matt Clay f328c0e259 Fix resource name length. 5 years ago
Rick Elrod d92820c2d5
[centos6] update container for EOL (#72797)
* [centos6] update container for EOL

Change:
- Reference:
  https://lists.centos.org/pipermail/centos-devel/2020-December/056208.html
- Bump centos6 container to 1.25.0

Test Plan:
- ci_complete

Signed-off-by: Rick Elrod <rick@elrod.me>

* update EPEL 6 too which is now archived

Signed-off-by: Rick Elrod <rick@elrod.me>

* bump to 1.26.0

Signed-off-by: Rick Elrod <rick@elrod.me>
5 years ago