Commit graph

51693 commits

Author SHA1 Message Date
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
4e608c02fb
Add changelog and porting guide for _remote_checksum() deprecation (#75035)
I forgot to add it with the PR that made the changes.
2021-06-16 16:58:02 -04: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
Sam Doran
0467b1d477 file integration test - cleanup testing users and group 2021-06-16 10:06:12 -07:00
Gonéri Le Bouder
5b8fb4dcd3 ansible-test: exposes tiny_prefix variable
ansible-test aws provider now creates and exposes a new tiny_prefix
variable to provide a shorter prefix for the AWS tests.
2021-06-16 10:04:58 -07:00
Brian Coca
08fc43f3ea
document keywords (#74046)
* document kewyords

  also minoir tweak to local action/connection

* made corrections
2021-06-16 12:46:21 -04:00
Brian Coca
6fd61bb19f
add option def/handling to lookup (#74495) 2021-06-16 12:44:02 -04:00
Paul Smet
2e2a5829a2
Update FreeBSD Python version in intro_bsd.rst (#74938)
* Use the python pkg instead of a specific version
The python pkg contains a symlink to the default python interpreter.
2021-06-16 11:22:26 -04:00
Alan Hinchliff
3fa6e6d038
example hosts should match play (#74959) 2021-06-16 11:18:44 -04:00
bluikko
b0f62062d3
Async task change handling (#75020)
Async task changes should be handled in the async_status task.
2021-06-16 11:16:30 -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
David Shrewsbury
2387ce311f
remove reference to container ML (#75014) 2021-06-16 10:47:26 -04:00
Andrew Klychkov
5df82415b5
collections_using.rst: add note that manual upgrade is required when installing collections from Galaxy (#75024) 2021-06-16 10:32:12 -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
Felix Fontein
e6a7bc854c
Only consider directories which do have .deps files other than ancestor.deps. (#74987) 2021-06-15 14:35:34 -05:00
Felix Fontein
7f6edd78f9
Move Docker scenario guide to community.docker. (#74736)
The scenario guide has already been added to community.docker in
ansible-collections/community.docker#140
2021-06-15 10:12:49 -05: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
Toshio Kuratomi
576e0f6404
Update the porting guide for ansible 4.1.0 (#74965) 2021-06-10 19:45:52 -05: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
Felix Fontein
81ad125aa6
Fix name of subkey. (#74939) 2021-06-11 05:34:04 +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
Toshio Kuratomi
36287e9810 Remove ignores that are resolved on devel 2021-06-09 11:18:12 -07:00
Toshio Kuratomi
3f694e9f02 Ignore smart quotes in the dev guide translation.
The smart quotes are in the warning message to not use smart quotes.
2021-06-09 11:18:12 -07:00
Yanis Guenane
d45c2cec55 Localization: Import first set of translated files 2021-06-09 11:18:12 -07:00
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
Sviatoslav Sydorenko
346c7a765d
Use sphinx_ansible_theme Sphinx theme in docs (#74318) 2021-06-08 14:38:23 -05:00
Abhijeet Kasurde
d9001f8fd0
Fix intro docs (#74843) 2021-06-08 09:27:21 +05:30
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
Felix Fontein
acf09e56a2
Update inventory script references from c.g to ansible-community/contrib-scripts. (#74905) 2021-06-07 11:37:39 -05: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