Commit graph

2852 commits

Author SHA1 Message Date
Therry van Neerven 35a2345809
Fixed typo in yum package (#72964)
* yum: Fixed typo in failure message: nevra --> envra
* Added changelog fragment
2021-05-31 13:34:26 +05:30
Rukmangathan e0558ac193
yum action plugin: 'use' as an alias of 'use_backend' (#70792)
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: rukmangathan <rukmangathan.annadurai@gigamon.com>
2021-05-31 09:48:15 +05:30
Sloane Hertel 5640093f1c
Use the module redirect_list when getting defaults for action plugins (#73864)
* Fix module-specific defaults in the gather_facts, package, and service action plugins.

* Handle ansible.legacy actions better in get_action_args_with_defaults

* Add tests for each action plugin

* Changelog

Fixes #72918
2021-05-27 19:06:45 -04:00
Brian Coca a5a13246ce
ssh remove unused/unusable cli option ssh_args (#74846) 2021-05-27 17:16:54 -04:00
Boris Korzun 99a983c92c
config: small typo fix (#74845) 2021-05-27 16:41:20 -04:00
Abhijeet Kasurde 148d4f6248
hostname: Add support for RedOS (#74844)
Fixes: #74779

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-05-27 21:18:48 +05:30
geliwei 138b3b6851
hostname: add support for Anolis distro (#74829)
project website https://openanolis.org/

Signed-off-by: Liwei Ge <geliwei@openanolis.org>
2021-05-27 18:30:35 +05:30
Rick Elrod 2ad10ffe43 hostname: Make strategies consistent, drop py2.4
Change:
- Make strategies behave consistently and return the empty string
  instead of "UNKNOWN" (or "temporarystub") for the "before" value if
  the permanent hostname file does not exist or could not be read.
- Switch to `with open()` instead of annoying exception handling code
  (which was wrong and leaked file handles in several places). This
  drops Python 2.4 support for this module.
- Updated porting guide since users could be relying on these former,
  inconsistent values.

Signed-off-by: Rick Elrod <rick@elrod.me>
2021-05-27 13:15:52 +02:00
Rick Elrod 8a0abed1ba [hostname] don't write in get_*() methods
Change:
- Hostname strategies' get_*() methods should never write to the
  filesystem. They are used in check_mode by default to determine if
  there is any work to be done.

Test Plan:
- New unit tests to ensure that (at least when in check_mode) the get
  methods don't ever call write.

Tickets:
- Fixes #66432

Signed-off-by: Rick Elrod <rick@elrod.me>
2021-05-27 13:15:52 +02:00
Abhijeet Kasurde ae50d05182
ini: Add parameter to allow no value (#74806)
ConfigParser allows to read key with no value.

Fixes: #50594

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-05-27 11:12:38 +05:30
Matt Clay 397d3763ea ansible-test - Do not downgrade cryptography. 2021-05-26 13:31:03 -07:00
Matt Martz 98138584b7
Don't mutate os.environ in AnsibleModule.run_command, make a copy, and pass to Popen (#74791)
* Don't mutate os.environ in AnsibleModule.run_command, make a copy, and pass to Popen. Fixes #74783

* Simplify code a bit

* More simple

* Address some other potentially non threadsafe operations

* Add if around umask

* Address unit test assumptions

* Add clog frag

* yaml syntax issue
2021-05-25 12:00:47 -04:00
Matt Martz df5ce3e672
Remove deprecated cache support from script inventory plugin (#74813) 2021-05-25 11:35:46 -04:00
Matt Martz d27ce4cef3
Remove deprecated features from ansible.playbook.helpers (#74809)
* Remove deprecated features from ansible.playbook.helpers. Fixes #74135
2021-05-25 11:35:17 -04:00
Abhijeet Kasurde 27f61db86b
service: Document internal working of the module (#74726)
service module acts as proxy module for all service manager modules,
just like `package` module.
This is helpful in heterogeneous environments to manage services.

Fixes: #74507

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-05-25 20:55:21 +05:30
Matt Martz 4a4ffbadc5
Remove deprecated PlayContext.make_become_cmd (#74790) 2021-05-25 11:03:55 -04:00
Abhijeet Kasurde 52430d4228
dnf - fix whatprovides API block (#74764)
* Added additional query block
2021-05-24 13:02:28 -04:00
Abhijeet Kasurde 1bd7dcf339
encrypt: add new paramter 'ident' (#74595)
Add a new parameter `ident` for specifying version of BCrypt
algorithm. This parameter is only valid for `blowfish` hash type.
2021-05-24 11:46:37 -04:00
Matt Martz bc48eba896
Remove deprecated include vartags usage (#74780)
* Add clog frag
* Remove ignore
2021-05-20 15:32:52 -04:00
Sam Doran 71e33d2578
version test - improve message when value is empty (#74754)
When an empty value is provided, no `version` attribute will exist on the `LooseVersion` or
`StrictVersion` object. We catch and handle this, but it's not immediatebly clear that an
AttributeError means an empty value was provided.

Specifically handle the case where value or version are empty and add more
helpful error messages.

Add integration tests.
2021-05-20 11:55:30 -04:00
Alex Haydock 724a0c867e
Fix mistaken detection of atomic_container when rpm-ostree is present (fixes #74578) (#74579)
* Lower the priority of the atomic_container detection now that we have #73445 merged

* Add changelog fragment
2021-05-19 16:15:26 -04:00
Brian Coca d2d1f01f9d
avoid literal quoting in config lists (#74740)
* added tests
2021-05-19 16:14:52 -04:00
Sam Doran c0cb353ce1
Remove PyCrypto (#74699)
* Remove PyCrypto from setup.py and packaging script
* Remove mention of pycrpto from installation docs
* Remove PyCrypto from vault
* Remove pycryto constraint and unit test requirement
* Remove PyCrypto tests from unit tests
* Add docs and fix warning message
* Remove section about cryptography library in Ansible Vault docs
2021-05-18 16:12:32 -04:00
Sloane Hertel 9cfedcd9c9
Add changelog for ansible-galaxy improvements (#74738)
Changelog for #74240
2021-05-17 16:31:13 -04:00
Matt Clay ce04056797 Expand delegation options for coverage commands. 2021-05-17 10:37:42 -07:00
Jordan Borean e875e91363
ansible-test - use pwsh to generate stubs (#74271) 2021-05-17 10:00:06 -07:00
Sam Doran d8e6f21d9f
ini lookup - add case sensitive option (#74630)
* Add tests for case-sensitive option
* Run all test playbooks from a single file
2021-05-17 11:41:23 -04:00
Brian Coca 173d0a8de7
Skip interpreter discovery for network OSs(#74012)
skip python interpreter discovery on network os being set as this indicates a 'forced local' module and should use sys.executable.
2021-05-14 10:19:55 -04:00
David Shrewsbury 51b5659598
replace - better handling of file exceptions (#74686) 2021-05-13 17:00:22 -04:00
Brian Coca 35281e54d9
fix config to match doc split (#74665) 2021-05-14 05:20:32 +10:00
elara-leitstellentechnik c6ac9de67b
Do not remove non-empty cron tabs (#74497)
* Only remove crontabs if they are empty

* Add integration test to ensure system cron tab doesn't get removed. Increase cron integration tests separation.
* Also detect crontab which only contains whitespace as empty.
* cron integration test: Adjust system crontab path to be distribution specific.

Co-authored-by: Fabian Klemp <fabian.klemp@elara-gmbh.de>
2021-05-13 13:38:13 -04:00
Mark Mercado 1906d75907
Adding DigitalOcean cloud support to ansible-test (#74222) 2021-05-12 16:07:21 -07:00
Matt Martz d6e28e6859
Update vendored copy of six to 1.16.0 (#74680)
* Update to six 1.16.0

* Address linting issues

* Remove six find_spex/exec_module warning filters

* Remove unnecessary comment about Py2.6, 2.13 will not support Py2.6, and we're bumping this for 2.12

* ci_complete

* Add changelog fragment
2021-05-12 16:26:48 -05:00
Sam Doran 0affe4d027
ini lookup - catch and handle duplicate key and missing section errors (#74629)
* Remove unused import
* Add integration tests for errors
* Cleanup formatting on existing tests
* Add changelog
2021-05-12 16:57:02 -04:00
Sam Doran f99d024851
CI and compat fixes for Jinja2 >= 3.0 (#74666)
* Add constraint for MarkupSafe

MarkupSafe >= 2.0.0 requires Python >= 3.6.0. Add a constraint for older Python versions
and fix the `groupby_filter` test.

* Fix template_jinja2_latest test.

* patch filter decorators on newer Jinja2

* Jinja2 >= 3.0 renames several filter decorators used by Ansible itself, as well as by filters in collections. This patch ensures that the old names are usable within Ansible and by collections without warnings or errors.

* Ignore docs-build issues.

Co-authored-by: Matt Clay <matt@mystile.com>
Co-authored-by: Matt Davis <mrd@redhat.com>
2021-05-11 19:59:44 -07:00
Abhijeet Kasurde 1006363589
basic: Skip over module parameters (#74559)
While logging, journal.send accepts module parameters.
If module parameters similar to arguments in journal.send,
rename the parameter names before sending to journal.send

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-05-11 15:05:56 -04:00
Brian Coca 2c93b22043
use self.host which will always be updated (#74574)
* use self.host which will always be updated

  pc remote_addr is not correctly updated in all cases
2021-05-11 14:49:56 -04:00
Matt Martz 8d1cf7f266
Vendor distutils.version (#74644)
* Vendor distutils.version

* Fix import order. ci_complete

* remove distutils warning filter

* Don't remove warnings filter from importer

* ci_complete

* Add pylint config for preventing distutils.version

* Add changelog fragment
2021-05-11 12:33:51 -05:00
Brian Coca ddaa539ab1
Better handling of rstisms in ansible-doc (#74596)
* Better handling of rstisms

  replace tags more intelligently to make things more readable
  unit tests + minor adjustments
2021-05-11 11:31:20 -04:00
Sloane Hertel cf11c38caf
Exclude unreachable hosts in ansible_play_batch between plays (#74625)
ci_complete
2021-05-11 17:12:34 +02:00
Shane St Savage df6554c4ec
fix: action _fixup_perms2 macos +a remote_paths in list() as it can be a tuple (#74613)
* fix: action _fixup_perms2 macos +a remote_paths in list() as it can be tuple

in `lib/ansible/plugin/action/__init__.py`'s `_fixup_perms2`,
`remote_paths` can be a list or tuple. however, the macos
specific attempt to use chmod +a attempts to concatenate
`remote_paths` with a list, which will fail if it is a tuple.
wrapping `remote_paths` in `list()` fixes this error.

* Update changelogs/fragments/74613-actionfixup_perms2_macos_remote_paths_ensure_list.yml

Co-authored-by: Rick Elrod <rick@elrod.me>
2021-05-11 17:08:33 +02:00
David Shrewsbury 8fb54885bf
Role argspec: allow new argument spec file (#74582)
* support separate role argspec file in ansible-doc

* support separate role argspec file in ansible-core

* support both .yml and .yaml extensions on argspec file in ansible-doc

* fix filename building bug and rename some argspec files to test variations

* use yaml extensions from constants

* add superfluous meta/main.yml files to tests

* Update lib/ansible/cli/doc.py

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

* update docs

* ci_complete

* add changelog and allow for main.yml variations

* add collection role testing

Co-authored-by: Sam Doran <sdoran@redhat.com>
2021-05-11 09:29:47 -05:00
Matt Clay 7b0c4845d9 Remove PyYAML warning filter in import test.
The filter is obsolete now that PyYAML imports go through our compat layer.
2021-05-10 16:57:45 -07:00
Brian Coca 7f7d3067e3
adhoc clarify help (#74616)
also added comments to code
2021-05-10 13:28:59 -04:00
Matt Clay 51fd05e76b Add support for testing with Python 3.10. 2021-05-10 08:23:15 -07:00
Ruediger Pluem 2f7e0b8489
user - consistently create user home directory on Linux (#71952)
Always use create_homedir when we are asked to create a home directory
in the User class. Don't use the -m and -k parameters from
useradd / luseradd as they behave differently with respect to
preexisting home directories. Instead always specify -M to ensure
that useradd / luseradd do not try to create the home directory.

This does not change potential different behaviours in child classes
of the User class.

Consider the new umask option from #73821 in create_homedir as well as
we do not let luseradd / useradd create the home directory any longer.
2021-05-07 17:00:10 -04:00
René Moser 403a5d147d
modules: get_url: Fix checksum binary validation (#74502)
From the sha512sum man page:

... The default mode is to print a line with checksum, a character indicating type ('*' for binary, ' ' for text), and name for each FILE.
2021-05-07 10:29:22 -04:00
Abhijeet Kasurde 4d7dc15d4e
service - compare version without LooseVersion (#74508)
The distutils module is not shipped with SUNWPython on Solaris.
It's in the SUNWPython-devel package. Do not use LooseVersion.

Fixes: #74488

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-05-07 10:22:00 -04:00
Jordan Borean a277644301
Add python 3.10 constraint for pyspnego (#74612) 2021-05-06 23:53:50 -07:00
Matt Clay e6d7aecbe4
Reorganize more ansible-test code. (#74611)
* Split out shell command.
* Relocate ansible-test integration code.
2021-05-06 17:59:07 -07:00