Commit graph

31527 commits

Author SHA1 Message Date
Brian Coca 50b6d28ee1
Config init+ (#74914)
Can now specify plugin/plugin type for list and dump actions
 New 'init' action to create usable config sources 

Co-authored-by: Felix Fontein <felix@fontein.de>
2021-06-22 12:21:59 -04:00
David Shrewsbury 703cb79442
Implement async callbacks (#74953)
* add changelog and output from default callback
* add test
* add comments about TE task
2021-06-22 12:19:32 -04:00
Sloane Hertel ca6123e0ee
Template suboptions in a role's arg spec (#75073) 2021-06-22 17:24:02 +02:00
Abhijeet Kasurde b0ae3f8a8d
test: Unit tests for validation methods (#75061)
* check_required_one_of()
* check_required_by()
* check_required_if()
* check_missing_parameters()

Fixes: #55994

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-06-22 17:07:30 +02:00
Nasser Alansari 6dbfd73174
YAML representer for VarsWithSources (#68525) 2021-06-22 20:03:18 +05:30
Junegunn Choi 8e755707b9
Add 'hash_behaviour' option to include_vars module (#72944) 2021-06-22 09:29:53 +05:30
Felix Fontein c404a9003f
ansible-doc: improve version_added handling (#73602)
* Output version_added on top level, and improve version_added formatting

* Handle 'historical' version_added.
2021-06-21 16:27:00 -04:00
Ikko Ashimine 38a11c3240
Fix typo in default_callback.py (#75051)
Changed beggining -> beginning
2021-06-18 10:01:11 +05:30
Sam Doran cd473dfb2f
play - validate hosts entries (#74147)
* Change tests to pytest-style tests
* Add tests for invalid hosts
* Validate host inputs
  - check for empty values
  - check for None
  - check for values that are not a sequence and are not strings
  - add unit tests

* Move play name setting to get_name() and out of load()
* Add _validate_hosts() method
  By defining this method, it gets called automatically by FieldAttributeBase.validate().
2021-06-17 15:32:56 -04:00
Brian Coca e8ae7211da
deprecate FileLock (#75032)
Co-authored-by: flowerysong <junk+github@flowerysong.com>
2021-06-17 15:14:41 -04:00
Matt Clay ce17498ec5
blockinfile - Remove unused code for Ansible 1.x. (#75040) 2021-06-17 10:32:42 -04:00
Matt Clay 5e65d9834b
tempfile - Remove unnecessary conditional. (#75039)
Also add integration tests for 100% code coverage.
2021-06-17 09:41:09 -04:00
Sam Doran afe6eb574e
slurp - improve error code and test coverage (#75038)
* Improve the error handling code

Rather than multiple return paths, have a single return and set the message based
on the type of failure.

* Add another test for non-specific failures

* Reorganize tests so failure tests are in one tasks file

* Remove os.stat() call and add changelog
2021-06-16 15:08:34 -07:00
Sam Doran 4ab791d501
command - remove unreachable code and achieve full test coverage (#75036) 2021-06-16 15:06:18 -07:00
Sam Doran be0cdc0ea2
deprecate _remote_checksum() and remove use in fetch (#74848)
* Remove use of _remote_checksum from fetch module
* Add deprecation message displayed during runtime
* Increase test coverage for fetch
* Add tests covering the use of stat from the fetch module

    This required creating an unpriveleged user account and connecting as that user remotely since
    it is not possible to create a file that the root user cannot stat.

* Use fact caching to persist remote tmp dir across playbook runs
* Add variables to setup_remote_tmp test role to allow caching of the remote temp dir fact
  and preventing removal of the remote_tmp_dir
2021-06-16 13:51:07 -04:00
Brian Coca 5a5a1882d4
Added FAQ entry for complex validation needs (#74707)
* Added FAQ entry for complex validation needs

* updated validate docs

* fix

* longline

* Apply suggestions from code review

Co-authored-by: Sandra McCann <samccann@redhat.com>
2021-06-16 13:43:01 -04:00
Brian Coca 7d38bb05e4
small note about add_hosts/limit interaction (#74978)
clarifying the scope and applicability

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Sandra McCann <samccann@redhat.com>
2021-06-16 11:13:11 -04:00
Manuel Gutierrez 4cb20f577b
Fix env lookup docs typo (#75022)
- Fixed "impossbile" typo
2021-06-16 10:00:15 -04:00
Brian Coca 79a0799082
fix typo in host_group_vars config (#75012)
* no need to deprecate, not used directly

  it just documents the use of the setting in loader
2021-06-15 18:03:01 -04:00
Jordan Borean 58d8397771
psrp - cleanup command (#74985) 2021-06-15 07:33:56 +10:00
Felix Fontein 58450f041a
Do not show empty version_added_collection values in ansible-doc text output. (#74999) 2021-06-14 17:26:40 -04:00
Brian Coca 77e936bd50
async_status revert most changes, keep some fixes, undep module (#74931)
* revert most changes, keep some fixes, undep module

  too many corner cases, reverting major changes for controller
  side processing.
2021-06-14 16:39:59 -04:00
David Shrewsbury 97acb0f470
role argspec - tag role argspec validation task with 'always' (#74994)
* update tag docs
2021-06-14 13:28:56 -04:00
Brian Coca d2d45900ed
setup module, filter compensate for prefixes (#74924)
Allow user to abstract internal implementation from requested info
2021-06-14 09:32:28 -04:00
Jordan Borean cf3a304ce1
psrp - Fix reset connection on failed scenarios (#74967)
* psrp - Fix reset connection on failed scenarios

* Update psrp-reset.yml

* Update changelogs/fragments/psrp-reset.yml

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>

* Update changelogs/fragments/psrp-reset.yml

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-06-12 12:01:23 +10:00
Sam Doran a8cf0196f7
subversion - fix stack trace when getting repository information (#74405)
* subversion - set LC_ALL for accurate command output parsing

When LC_ALL is not set, the output language of commands will differ based on locale. There
is a lot of history of trying to fix this. See the following pull requests:

https://github.com/ansible/ansible-modules-core/pull/4358
https://github.com/ansible/ansible-modules-core/pull/4358

This patch attempts to fix this my setting LC_ALL to a UTF-8 locale. Setting LC_ALL to C reintroduces this bug https://github.com/ansible/ansible-modules-core/issues/4178.

I'm sure there are some problems I am not seeing with setting this to en_US.UTF-8, but that is
the only way I could find to fix this bug without reintriducing the bug mentioned above.

* Rather than setting locale, just check for matches before trying to get groups

This is a pragmatic solution to avoid the stack trace since setting the locale correctly
to ensure message parsing is accurate is problematic.

* Improve regexps for finding revision and URL
2021-06-11 10:23:42 -04:00
Sam Doran 9a21e24778
get_distribution - Return distribution for all platforms (#71641)
Since moving to distro, it is possible to return this information for all platforms, not just Linux.
Also return version information for all platfrom not just Linux.
Update unit tests.
Remove some duplicate unit tests though I think there are more to remove.

* Fix docstring formatting

* Minor docstring changes

* Mock distro.id for Solaris service test

* Update comment
2021-06-11 10:22:18 -04:00
Brian Coca 4c8c40fd3d
fix unsafe preservation across newlines (#74960)
* fix unsafe preservation across newlines

  CVE-2021-3583
  ensure we always have unsafe

Co-authored-by: Rick Elrod <rick@elrod.me>
2021-06-11 09:33:40 -04:00
Daniel Ziegenberg 473df5c13f
fix doc: add possible state 'inactive' (#74928) 2021-06-11 14:58:00 +10:00
Brian Coca 675df166c2
fix ssh_transfer_method/scp_if_ssh defaults (#74925)
* fix ssh_transfer_method/scp_if_ssh defaults

  fixes #74922

* clog
2021-06-10 15:22:41 -05:00
Jonathan Kirszling 50e998e303
apt_key: add --recv argument as last one (#74949)
* apt_key: add --recv argument as last one

* Add unit test

* Add the required boilerplate

Co-authored-by: Marius Gedminas <marius@gedmin.as>
2021-06-11 05:47:59 +10:00
David Shrewsbury 6539c59857
ansible-pull - update help info for --directory option (#74936)
* Update -d help info for ansible-pull

* fix pep8
2021-06-11 05:31:17 +10:00
Martin Krizek 5ac1b04929
Add support for unicode in ansible-inventory CLI (#74912)
* Add support for unicode in ansible-inventory CLI

Fixes #57378

* Add tests

* First test fix

* --output tests

* fix
2021-06-11 05:07:55 +10:00
Sam Doran 0a5cc80ce2
slurp - handle error when path is a directory (#74930) 2021-06-10 10:25:48 +05:30
Brian Coca 1c4ca154fa
improve inv plugin selectino for snippets (#74933)
* improve inv plugin selectino for snippets
* add warning on no snippet for inventory
2021-06-09 12:13:56 -04:00
Brian Coca 6d2398db28
expand doc snippets to lookups and other plugins (#74403)
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
2021-06-07 16:21:25 -04:00
Sam Doran 004c33d9c5
unarchive - do not fail in init when trying to find required binary (#74892)
Test for the required binaries in the can_handle_archive() method and fail there. This
prevents failures for missing binaries unrelated to the archive type.

* Update missing zip binary message to match tar message
* Update unit tests
* Add integration tests
* Define packages based on the system rather than ignoring failures
2021-06-07 12:59:06 -04:00
Brian Coca 5dd8dc8fd0
minor service_mgr facts fixes (#74894)
* minor service_mgr facts fixes

  handle case in which ps command fails or returns empty
  updated tests since it now does keep trying to detect after ps fails
2021-06-04 15:28:41 -04:00
Brian Coca 6840b79e56
bring back async_status module for direct callers
also, deprecate it, they should use action instead
Co-authored-by: Felix Fontein <felix@fontein.de>
2021-06-04 13:01:26 -04:00
s-hamann e2658801f6
Add seed parameter to password lookup (#69775) 2021-06-04 12:20:44 -04:00
Matt Martz ffa548503d
Wrap all results, regardless of register, except for actions with clean facts (#73161)
* Wrap all results, regardless of register, except for actions with clean facts. Fixes #21088

* ci_complete

* Add tests

* Add clog frag
2021-06-04 16:40:53 +02:00
Hideki Saito e70fc88656
slurp - better error handling for unreadable files and directories (#68608) 2021-06-04 10:38:23 -04:00
Brian Coca 26827f5039
ansible-doc fix displaying 'CLI' options for plugin docs
cli options will now display either use provided info, or automating from the name


Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2021-06-04 10:22:39 -04:00
Brian Coca 6a883f1cd6
better message and timeout warning when timeout (#74885)
* better message and timeout warning when timeout
2021-06-04 10:21:12 -04:00
Martin Krizek 4f3ee4624e
Add end_batch meta task (#74899)
* Add end_batch meta task

* Add note

* Fix sanity
2021-06-04 05:17:19 +10:00
Matt Martz ac77911491
Prevent conditional templating errors from masking task output. Fixes #37187 (#74891) 2021-06-04 05:11:01 +10:00
Abhijeet Kasurde 8f82e6327f
ansible-cli: Remove unnessary trailing space (#74880)
Fixes: #74875

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-06-04 05:07:54 +10:00
Matt Martz 840825b79c
Allow omit to work with include_role from_args (#74879)
* Allow omit to work with include_role from_args. Fixes #66349

* Add clog frag
2021-06-04 05:07:16 +10:00
Johannes Heimansberg b023f34f4a
service_mgr: Detect using symlink if proc/1 and ps fail
* runit and other alternative service managers tend to work via symlink so this covers most of em
* Fixes #74866.
2021-06-03 09:59:31 -04:00
Brian Coca 9c718ccc42
Async status rewrite
-  remove need for module (at least for posix side)
  - adds retry with backoff on fetching file, since
    race is bigger since we don't spend time on module
  - now gives more info on fail
  - also made actionfail/skip handle results if given
2021-06-03 09:54:40 -04:00