Commit Graph

5074 Commits (a048dcba68276fee7d6631af80c7a714a3dfe4f3)

Author SHA1 Message Date
David Shrewsbury a048dcba68
[2.9] Make sure ansible_become treated as a boolean (#70484) (#70527)
* Make sure ansible_become treated as a boolean (#70484)

* Make sure ansible_become treated as a boolean

(cherry picked from commit 8aca464b8b)

* Update test/integration/targets/inventory_ini/aliases

Co-authored-by: Sam Doran <sdoran@redhat.com>

Co-authored-by: Sam Doran <sdoran@redhat.com>
4 years ago
Martin Krizek 99a37234b7
Fix delegate_facts with interpreter not being set (#70293) (#70385)
Fixes #70168

ci_complete

Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit b05e00e99a)
4 years ago
Sloane Hertel c00009bc41
[2.9] Handle post_validate templating errors and add tests (#70240) (#70390)
* Handle post_validate templating errors and fix tests (#70240)

* Handle unexpected templating errors

* Fixes #70050

Fix up tests that weren't running and add tests for graceful templating error handling

(cherry picked from commit 30e70f4b63)

* changelog

ci_complete
4 years ago
Sam Doran 93f2f47d4c
[stable-2.9] Pin psutil version in tests (#70715)
A recent update to psutil introduced a breaking change
4 years ago
Brian Coca caaf295a37
return changed for group_by (#32057) (#69860)
* return changed for group_by

* added tests and fixed 'early registeration'

(cherry picked from commit 22da903e9c)
4 years ago
Sam Doran b8cae337cd
[stable-2.9] ansible_runner test - Add constraints (#70667) (#70670)
A recent updated to psutil, which is a dependency of ansible-runner, fails
to install on older versions of pip.

Commit with the breaking change:

  135628639b
(cherry picked from commit 9d27d7c8b1)

Co-authored-by: Sam Doran <sdoran@redhat.com>
4 years ago
Sam Doran f3872c4996 Disable hcloud_server_network test 4 years ago
Matt Clay 3b0e0a8194 Remove Azure module tests from CI. 4 years ago
Rick Elrod 194308ea97 pip tests, use py2 compat sampleproject fork
Change:
- sampleproject has gone py3 only. Use a py2 compatible fork.

Test Plan:
- CI

Signed-off-by: Rick Elrod <rick@elrod.me>
4 years ago
Sumit Jaiswal d672ee1c03
To backport ios_user and ios_command TC failure fix (#70253) 4 years ago
Sam Doran 89dfe82705
[stable-2.9] Pin version of netaddr in docker_container test (#70210) 4 years ago
Sam Doran cd7dfcebab [stable-2.9] Pin version of netaddr and jmespath in filters test 4 years ago
Jordan Borean 84a60f1883
galaxy - preserve symlinks on build/install (#69959) (#69994)
* galaxy - preserve symlinks on build/install (#69959)

* galaxy - preserve symlinks on build/install

* Handle directory symlinks

* py2 compat change

* Updated changelog fragment

(cherry picked from commit d30fc6c0b3)

* Fix integration test

* ansible-galaxy - fix collection installation with trailing slashes (#70016)

If we fail to find a member when extracting a directory, try adding a trailing
slash to the member name. In certain cases, the member in the tarfile will
contain a trailing slash but the file name in FILES.json will never contain
the trailing slash.

If unable to find the member, handle the KeyError and print a nicer error.

Also check if a directory exists before creating it since it may have been
extracted from the archive.

Fixes #70009

* Add unit tests
* Use loop for trying to get members

(cherry picked from commit d45cb01b84)

Co-authored-by: Sam Doran <sdoran@redhat.com>
5 years ago
Abhijeet Kasurde f79c606aae
copy: ensure _original_basename is set (#70088)
* added changelog fragment
* added quick and basic test
* Revert "added quick and basic test"
* This reverts commit 75f4141656.
* added better tests
* now also creating files to copy on the remote
* removed tests for recursive copying which is not supported by remote_src

Fixes: #47050

(cherry picked from commit 79dfae9624)

Co-authored-by: Moritz Grimm <memo42@users.noreply.github.com>
5 years ago
Sloane Hertel 1f3185d3eb
Allow tasks to notify a fqcn handler name (#68213) (#70074)
* Allow tasks to notify a fqcn handler name

* Add tests. Fixes #68181

* Add changelog fragment

* Add test to ensure handlers are deduped properly with fqcn, role, and just handler names

* Add some docs about new special vars

(cherry picked from commit 087be1da50)

Co-authored-by: Matt Martz <matt@sivel.net>
5 years ago
Hideki Saito b8a81973ee
Backport of dnf module logging (#69480) (#70066)
Signed-off-by: Hideki Saito <saito@fgrep.org>
5 years ago
Brian Coca e0322a0420
implemented 'prefix' for file based cache (#69872) (#70008)
* implemented 'prefix' for file based cache

Co-authored-by: s-hertel <shertel@redhat.com>
(cherry picked from commit ebb22655e4)
5 years ago
Alex Schultz a5c85b477b
Fix IncludedFile equality check (#69524) (#69885)
In the case of a free style strategy, it is possible to end up with
multiple hosts trying to include from the same role, however the tasks
being included may be different with the use of tasks_from.  Previously
if you had two hosts that were included the same role when the
process_include_results function tries to determine if a included needs
to be run on a specific host, it would end up merging two different
tasks into which ever one was processed first.

This change updates the equality check to also check if the task uuid
associated with the IncludedFile is the same. The previous check only
checked if the task's parent uuid was the same. This breaks down when
both includes have the same parent.

    - hosts: all
      strategy: free
      gather_facts: false
      tasks:
        - include_role:
            name: random_sleep
        - block:
          - name: set a fact (1)
            include_role:
              name: set_a_fact
              tasks_from: fact1.yml
          - name: set a fact (2)
            include_role:
              name: set_a_fact
              tasks_from: fact2.yml
        - name: include didn't run
          fail:
            msg: >
              set_a_fact didn't run
              fact1: {{ fact1 | default('not defined')}}
              fact2: {{ fact2 | default('not defined') }}"
          when: (fact1 is not defined or fact2 is not defined)

Closes #69521

(cherry picked from commit 247e43b252)
5 years ago
Paul Belanger 16f0b7461c
Support `removed_at_date` in ansible-doc (#70002) (#70015)
* Support removed_at_date in ansible-doc

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

Changes:
  * ansible-doc does not support `removed_at_date` and assumes that
    deprecated dict will either have `removed_in` or `version`. This
    results in ansible-doc (and hence "sanity --test=ansible-doc")
    failing for modules having only `removed_at_date`.

  * This patch adds support for `removed_at_date` and also gives it
    precedence over `removed_in` or `version`.

* Add tests and changelog

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
(cherry picked from commit 9d6b0f2b03)
Signed-off-by: Paul Belanger <pabelanger@redhat.com>

Co-authored-by: Nilashish Chakraborty <nilashishchakraborty8@gmail.com>
5 years ago
Jill R 41bed21e20
ec2_group: Ensure group-based rule targets have consistent data formats (#69748)
Ensure group-based rule targets have consistent data formats throughout the module.
Backported from https://github.com/ansible-collections/amazon.aws/pull/33
5 years ago
Alex Schultz 4a5f9e87cc
Split regular and handler results into their own queues (#69498) (#69730)
When mixed with the free strategy (or any custom strategy that does not behave in
a lock-step manner), the linear methodology of _wait_on_handler_results may cause
race conditions with regular task result processing if the strategy uses
_process_pending_results directly. This patch addresses that by splitting the queues
used for results and adding a flag to _process_pending_results to determine which
queue to check.

Fixes #69457

(cherry picked from commit a4072ad0e9)

Co-authored-by: James Cammarata <jimi@sngx.net>
5 years ago
Nilashish Chakraborty 307d86de4b
Fix system default dict generation (#69690)
Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

Add changelog
5 years ago
Brian Coca 4f39d9ac65
avoid fatal tb on bad fqcn callback name (#69440) (#69496)
(cherry picked from commit 0aa76503dc)
5 years ago
Nilashish Chakraborty 156b302b4b
Fix issue with replaced (#69477)
Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

Add changelog
5 years ago
Daniel Mellado e652706d63
Add missing options for GRE interface (#69426)
This commit adds some missing options related to gre interfaces on
junos_interfaces module.

Cherry-picked from https://github.com/ansible-collections/junipernetworks.junos/pull/37
Fixes: https://github.com/ansible-collections/junipernetworks.junos/issues/36

Signed-off-by: Daniel Mellado <dmellado@redhat.com>
5 years ago
Martin Krizek 54d96eae8c
Ensure --version works with non-ascii project path (#66624) (#69789)
Fixes #66617

(cherry picked from commit 3606dcfe65)
5 years ago
Abhijeet Kasurde 153de5ee49
[2.9] podman_image: use correct option for remove_signatures flag (#68979)
podman_image module uses 'podman push' command with wrong
flag '--remove_signatures' instead of '--remove-signatures'

This patch fixes the given typo.

Fixes: ansible/ansible#67965

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
5 years ago
Felix Fontein cf244c094a
[2.9] Prevent Ansible 2.9 to choke on collections using deprecation by date or collection_name for deprecation calls (#69935)
* Prevent Ansible 2.9 to choke on collections using deprecation by date or collection_name for deprecation calls.

* Add changelog fragment.

* Fix YAML.

* Improve C# compatibility.

* Add tests for AnsibleModule.

* Fix var name.

* Fix type.

* Update C# code.

* Show deprecation warning if removed_at_date is used for Python modules.

* Update changelogs/fragments/69935-2.10-deprecation-support.yml

Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>

* Prevent crash of validate-modules if 'removed_in' is not in 'deprecated'.

Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>
5 years ago
Abhijeet Kasurde 3e36350309
[2.9] Handle disabled service units (#69804)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 723a904f4e)
5 years ago
Sam Doran 6abe3a889d
[stable-2.9] file - return 'state': 'absent' when a file does not exist (#66503) (#69657)
This was changed in ansible/ansible#51350.
(cherry picked from commit cd8920af99)

Co-authored-by: Sam Doran <sdoran@redhat.com>
5 years ago
Brian Coca 9e00214fb4
fix delegation vars usage (debug still shows inventory_hostname (#69520)
* fix delegation vars usage (debug still shows inventory_hostname) (#69244)

* fix delegation vars usage and reporting

 - just pass delegated host vars + task vars to plugins
   and avoid poluting with original host vars
 - updated tests

(cherry picked from commit 2165f9ac40)

* fix delegated interpreter discovery (#69604)

* fix delegated interpeter
* allow returning fact if it is 'the right host'
* added note for future fix/efficiency
 as it stands we rerun discovery for the delegated host
unless its saving facts to itself
 * fixed test lacking delegate_to mock

(cherry picked from commit de3f7c7739)

* Fix `ansible -K` become_pass regression (#69629)

* Fix `ansible -K` become_pass regression

Change:
- This fixes a breaking change introduced in
  2165f9ac40

Test Plan:
- Local VM for now, with plans to add an integration test for -K going
  forward.

Tickets:
Refs #69244

(cherry picked from commit fe9696be52)

* fix discovery on loop with delegation (#70013)

* fix discovery on loop with delegation

fixes #69963

(cherry picked from commit 4c9d9dbb56)

Co-authored-by: Rick Elrod <rick@elrod.me>
5 years ago
Sam Doran 4c1777e26e
[stable-2.9] Properly handle unicode in safe_eval (#68576) (#69626)
* Properly handle unicode in safe_eval

Fixes #66943

* Update lib/ansible/template/safe_eval.py

Co-authored-by: Sam Doran <sdoran@redhat.com>.
(cherry picked from commit ecd986006e)

Co-authored-by: Martin Krizek <martin.krizek@gmail.com>

Co-authored-by: Martin Krizek <martin.krizek@gmail.com>
5 years ago
Sumit Jaiswal ef01267eb6
ios_l3 loopback backport (#69593) 5 years ago
Martin Krizek 4ed4d2d280
Validate args for includes in handlers too (#57537) (#69448)
(cherry picked from commit 9645304da3)
5 years ago
Chih-Hsuan Yen 6aca3a2c69
Fix/archive empty file (#64895) (#69420)
* Remove call to filecompare to fix issue with empty file exclusion from archive

* Add empty file

(cherry picked from commit 277dd54d45)

Co-authored-by: Nabil BENDAFI <nbendafi@yseop.com>
5 years ago
Felix Fontein 380be7581e
Address compat issue for collection loading on py26 (#68219) (#69402)
* Address compat issue for collection loading on py26

* Move import_module shim to utils for compat across the codebase

* Enable collection tests on py2.6

* Update changelog fragment

* Simplify code using sys.moduls

* Move compat to module_utils/compat/importlib

* Add back errantly deleted newline

* Remove hack comment

Co-Authored-By: Matt Clay <matt@mystile.com>

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

Co-authored-by: Matt Martz <matt@sivel.net>
5 years ago
Sam Doran f963aba45a
[stable-2.9] Pin Docker version at 19.03.1 (#69635) (#69645)
* [stable-2.9] Pin Docker version at 19.03.1
(cherry picked from commit fe941a4045)

Co-authored-by: Sam Doran <sdoran@redhat.com>

* [stable-2.9] Pin docker-ce-cli version in tests (#69620)

Installing docker-ce has a dependency of docker-ce-cli. If the version of docker-ci-cli is not specified, it installs the latest version.

(cherry picked from commit 889da811d7)
5 years ago
Mark Goddard 5a0d35646d Fix fileglob plugin with non-existent subdirectory
Since Ansible 2.9.8, if the fileglob plugin is passed a path containing
a subdirectory of a non-existent directory, it will fail. For example:

lookup('fileglob', '/'): ok
lookup('fileglob', '/foo'): (non-existent): ok
lookup('fileglob', '/foo/bar'): (non-existent): FAIL

The exact error depends on Python 2 or 3, but here is the error on
Python 2:

    AttributeError: 'NoneType' object has no attribute 'endswith'

And on Python 3:

    TypeError: expected str, bytes or os.PathLike object, not NoneType

This change fixes the issue by skipping paths that are falsey before
passing them to os.path.join().

Fixes: #69450
5 years ago
Matt Clay 28e9121d94 Disable failing azure_rm_dnszone test.
The module requires updates to work with the current Azure API.
5 years ago
Matt Clay 8b2957aac3 Revert "2.9: native types: literal_eval all the things (#68938) (#69044)"
This reverts commit 70b4ce5efd.
5 years ago
Jordan Borean 330112a45c Fix win_psmodule and win_psrepository tests 5 years ago
Ganesh Nalawade e40b96ed88
Refactor CLI prompt mode check for network plugins (#63945) (#69210)
* Refactor CLI prompt mode check for network plugins (#63945)

* Refactor CLI prompt mode check for network plugins

*  Move the CLI prompt mode check logic from action plugin
   to the controller side with the cliconf plugins.

*  This refactor also allows the network modules
   to initialise the persistent connection with remote device
   only when it is required.

* Fix review comments

(cherry picked from commit c27e47327f)

* Fix cli context check for network_cli connection (#64697)

* Fix cli context check for network_cli connection

Fixes #64575

*  Check cli context for network_cli connection
   at the start of new task run only.

* Pass task_uuid around to identify start of new task run

* Handle for local connection

(cherry picked from commit ee3f8d28a4)

* Add test for reboot & wait_for_connection on EOS & IOS (#63014)

* Add test for reboot & wait_for_connection

* Add test for ios

* Collection-proof block test

* Add junos test

* Don't try to evaluate cli context unless using the connection

* Prevent infinite recursion

* Update change log

(cherry picked from commit e19b94f43b)
(cherry picked from commit ee3f8d28a4)
(cherry picked from commit e19b94f43b)

devel:
https://github.com/ansible/ansible/pull/63945
https://github.com/ansible/ansible/pull/64697
https://github.com/ansible/ansible/pull/63014

Co-authored-by: Nathaniel Case <ncase@redhat.com>
5 years ago
Matt Martz 99e6f4ff54 [stable-2.9] Handle non-ascii paths during role installation. Fixes #69133 (#69213)
(cherry picked from commit bc41dd4)

Co-authored-by: Matt Martz <matt@sivel.net>
5 years ago
Matt Martz 6c2b372d1b [stable-2.9] Address fixme and handle filter/test errors for collections better (#68047)
* Address fixme and handle fitler/test errors for collections better. Fixes #66721

* Re-arrange code
(cherry picked from commit ee6413a)

Co-authored-by: Matt Martz <matt@sivel.net>
5 years ago
Jesse Pretorius (odyssey4me) 82378406ea [pip] Enable virtualenv_command to have arguments
Currently if virtualenv_command has arguments, then the
search for the binary in the path does not work so the
user has to specify the full path to it.

To allow arguments to be used without having to specify
the path to the binary, we split the module argument into
the command and anything after the first space.

This makes using this module argument more flexible and
user friendly.

Fixes: #52275
(cherry picked from commit da390b297e)
5 years ago
rwagnergit 081ce0e4e1 update ActionBase._low_level_execute_command to honor executable (#68315)
* update ActionBase._low_level_execute_command to honor executable

* adding changelog fragment

* renaming changelog fragment to .yml

* noop change to bump shippable

* adding raw_executable integration test

* copying aliases from raw

* removing blank lines

* skipping aix and freebsd

* noop to bump shippable

* moving tests to raw/

* removing become_method: sudo ; it doesn't work on AIX

* removing trailing blank line

* forcing become_method: su to try to get AIX to work

Co-authored-by: Rob Wagner <rob.wagner@sas.com>
(cherry picked from commit 977b58740b)
5 years ago
Andrew Klychkov 7cb8594e97 Bugfix of 67377: postgresql_set converts value to uppercase if "mb" or "gb" or "tb" is in the value string (#67418)
* Bugfix of 67377: postgresql_set converts value to uppercase if "mb" or "gb" or "tb" is in the value string

* fix CI

* add changelog

(cherry picked from commit 59bcc9f739)
5 years ago
Martin Krizek 70b4ce5efd
2.9: native types: literal_eval all the things (#68938) (#69044)
* native types: literal_eval all the things (#68938)

With https://github.com/pallets/jinja/pull/1190 merged our short-circuit
is no longer valid (has it ever been?) as now data like ' True ' may go
through our ansible_native_concat function as opposed to going through
intermediate call to Jinja2's native_concat before. Now we need to always
send data through literal_eval to ensure native types are returned.

(cherry picked from commit acdc9eb76d)

* Fix tests
5 years ago
Brian Coca b3a1288150 preserve json parsing error (#58461)
* preserve json parsing error
* added test

(cherry picked from commit bbdf77a59f)
5 years ago
Matt Martz e2f7676c5a [stable-2.9] Allow a collection role to call a standalone role by default (#69102)
* Allow a collection role to call a standalone role by default. Fixes #69101

* tweaked changelog text

* Guard against NoneType

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

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