Commit graph

51348 commits

Author SHA1 Message Date
Toshio Kuratomi 112a7718c6
Porting guide update for ansible-4.0 alpha3 (#74075) 2021-03-30 18:20:11 -05:00
Matt Clay b75844af45 Fix ansible-test coverage exporting.
ci_complete
ci_coverage
2021-03-30 14:30:15 -07:00
Amin Vakil 846c2d1ed3
Fix comment in iptables unit test (#74061) 2021-03-30 16:11:12 -04:00
Toshio Kuratomi 47ffa27416
Update the porting guide for a new ansible version (#74073) 2021-03-30 14:13:42 -05:00
chemsaf3 381bd1a575
import openbsd patches (#74056)
* add openbsd service info
* Create openbsd-service.yml
* Update var name
2021-03-30 12:17:40 -04:00
Baptiste Mille-Mathias 6b33864a2c
Clarify tags on tasks are applied with OR and not AND (#74038)
Co-authored-by: flowerysong <junk+github@flowerysong.com>
2021-03-30 11:05:54 -04:00
Rick Elrod 5e25ba62a6
Update Ansible release version to v2.11.0b4.post0. (#74064) 2021-03-29 21:45:32 -05:00
Rick Elrod ae90774f2b
New release v2.11.0b4 (#74063) 2021-03-29 19:31:47 -05:00
Matt Davis 454c7e37ec
nonzero exit code on ansible galaxy collection verify failures (#74051) 2021-03-29 13:06:02 -07:00
Alexander Sowitzki 1527078a8f
pause - do not continue with '\r' when timeout is set (#74030)
Original function of pause was, to only allow user input
(finished with enter) when no timeout was set. This restores
the behaviour.
2021-03-29 15:39:42 -04:00
Matt Davis a84c1a5669
add --offline option to galaxy collection verify (#74040)
* --offline allows in-place verify for installed collections with manifests
* manifest hash, collection name, version, and path are now always displayed
* test updates
2021-03-29 09:47:15 -07:00
Felix Fontein af7f3fc266
Revert "Add duplicated set filter and documentation (#72729)" (#74053)
This reverts commit 99a6627c60.

* ci_complete
2021-03-27 20:28:28 -05:00
Matt Martz 88d6a72178
Temporarily disable strategy units (#74048) 2021-03-26 19:10:00 -07:00
Baptiste Mille-Mathias 99a6627c60
Add duplicated set filter and documentation (#72729)
Co-authored-by: Kerry <kerry@flatline-studios.com>
2021-03-27 00:18:55 +01:00
Lydie def2870df7
updated link to ansible.builtin.user password (#73789) 2021-03-26 16:19:20 -05:00
Brian Coca 22330dd322
Correctly set path and fullpath for template vars (#73924)
* Correctly set path and fullpath for template vars

 don't expect path to always be full path
 also added exception/tb on action fail
2021-03-26 16:33:25 -04:00
Brian Coca 4a82e2c486
Fix setup subset (#74022)
* fix error msg on bad subset

* added test
* handle more raised but not handled fact exceptions
2021-03-26 12:43:16 -04:00
Alicia Cozine c66cff444c
documents the use of ansible.legacy (#73942) 2021-03-25 16:36:46 -04:00
Leandro Scardua 5dbcaa4c01
Update version on FreeBSD (#73664)
##### SUMMARY
<!--- Your description here -->
On the main freebsd change, and no the version: py37-ansible

##### ISSUE TYPE
- Docs Pull Request

+label: docsite_pr
2021-03-25 16:30:52 -04:00
Sandra McCann 59c61bc88a
update docs to uninstall ansible-base on upgrade (#74024) 2021-03-25 15:21:37 -05:00
sgpinkus 2abb2d3f17
Update playbooks_variables.rst. To say you can define variables within a playbook is somewhat misleading. Variables are defined within plays and are only visible within the play they are defined in *not* the entire playbook. There is no way to define vars to have strictly playbook scope. (#73986)
+label: docsite_pr
2021-03-25 16:05:50 -04:00
Marketka 0bf9b7fdf8
Added prerequisites to install for CentOS (#73993)
* Added prerequisites to install for CentOS as well so CentOS users don't have to look for alternatives for each Ubuntu package.

Signed-off-by: mm667937 <marketa.muzikova@broadcom.com>


Signed-off-by: mm667937 <marketa.muzikova@broadcom.com>
2021-03-25 16:03:32 -04:00
Baptiste Mille-Mathias 584432be26
Use FQCN for module set_stats (#74028) 2021-03-25 15:26:48 -04:00
saruter 73c08df2db
Docs: Add filter "urlencode" with example (#74034)
* Add example for URLENCODE filter
2021-03-25 15:20:41 -04:00
Alicia Cozine eb631c1881
use present tense for porting guide entries (#74021)
Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
Co-authored-by: Sandra McCann <samccann@redhat.com>
2021-03-25 15:04:10 -04:00
Andrew Klychkov 46b02e125f
dev_guide/testing_integration: update image list (#74017) 2021-03-25 11:24:01 -07:00
David Greaves 4881ca1dcb
Introduce the concept of playbooks early on (#74018)
* Introduce the concept of playbooks early on
Co-authored-by: Sandra McCann <samccann@redhat.com>
2021-03-25 11:55:01 -04:00
Felix Fontein 940b7af7d8
argspec validation - fix apply_defaults (#74029)
* Add test
2021-03-24 19:17:07 -04:00
Mark Mercado 3bccfb1615
Updating Community docs with DO information (#74019) 2021-03-24 16:24:46 -04:00
Sam Doran fa1b52ce55
dnf test - update libmodulemd when updating python3-dnf (#74025)
The dependency version is set too low in the latest version of the package.

https://bugzilla.redhat.com/show_bug.cgi?id=1942236
2021-03-24 15:49:57 -04:00
Andrew Klychkov 77ec2b3b3a
Documentation: update committer_guidelines.rst (#73782)
Co-authored-by: Sandra McCann <samccann@redhat.com>
Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>
2021-03-24 15:30:55 -04:00
Toshio Kuratomi c8a7899869
Update the porting guide for a new ansible version (#74016) 2021-03-24 12:12:09 -05:00
Andrew Klychkov 0543916a86
Docsite: clarify a changelog entry format (#73902)
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Sandra McCann <samccann@redhat.com>
2021-03-24 11:21:34 -04:00
Sam Doran c4e211a429 apt_key - update key ID and URL used in test
The GPG key in getfedore.org/static/fedora.gpg changed and caused the test to fail. Update
to using the new key ID and save the GPG file in our S3 to prevent spontaneous changes/breakage.
2021-03-23 13:55:40 -07:00
Felix Fontein a1ece49006
Add integration tests for add_collection_to_versions_and_dates(), and extend ansible-doc tests (#73601)
* Add add_collection_to_versions_and_dates integration tests.

* Add doc fragment tests with fragments from other collections.

* Remove trailing whitespace (Python 2's json.dump inserts some).

* Use ' ' instead of '\s'.
2021-03-24 05:30:57 +10:00
Martin Nečas a520da0584
setup virtualization: fix RHEV product_name (#73919) 2021-03-23 21:18:01 +05:30
Jim Speir 4780e10a2b
Adding jborean93/WindowsServer2019 in docs (#73950) 2021-03-23 21:16:54 +05:30
Brian Coca c1eed681aa
fix wait_for looping when missing net module (#73963)
fixes #43486
2021-03-23 16:12:49 +01:00
Alex Willmer 6856e751ff
Fix trailing whitespace in Conditional debug() (#73956)
Signed-off-by: Alex Willmer <alex@moreati.org.uk>
2021-03-23 16:08:44 +01:00
Brian Coca 232eeee206
less blocking on fact reading (#73951)
* less blocking on fact reading


Co-authored-by: Martin Krizek <martin.krizek@gmail.com>
2021-03-23 10:27:53 -04:00
Xabier Napal 2bff120db6
Fix wrong backup directory var name in apt module (#73840)
* Fix wrong backup directory var name in apt module
2021-03-22 10:06:45 -04:00
Rick Elrod 2c40dccd85
Update Ansible release version to v2.11.0b3.post0. (#73980) 2021-03-19 23:48:17 -05:00
Rick Elrod 88a1a85ff8
New release v2.11.0b3 (#73977) 2021-03-19 22:08:27 -05:00
Matt Davis c6cf7986ab
add porting guide info for optional module_utils (#73979) 2021-03-19 20:21:22 -05:00
Sam Doran abacf6a108
Use ArgumentSpecValidator in AnsibleModule (#73703)
* Begin using ArgumentSpecValidator in AnsibleModule

* Add check parameters to ArgumentSpecValidator

Add additional parameters for specifying required and mutually exclusive parameters.
Add code to the .validate() method that runs these additional checks.

* Make errors related to unsupported parameters match existing behavior

Update the punctuation in the message slightly to make it more readable.
Add a property to ArgumentSpecValidator to hold valid parameter names.

* Set default values after performining checks

* FIx sanity test failure

* Use correct parameters when checking sub options

* Use a dict when iterating over check functions

Referencing by key names makes things a bit more readable IMO.

* Fix bug in comparison for sub options evaluation

* Add options_context to check functions

This allows the parent parameter to be added the the error message if a validation
error occurs in a sub option.

* Fix bug in apply_defaults behavior of sub spec validation

* Accept options_conext in get_unsupported_parameters()

If options_context is supplied, a tuple of parent key names of unsupported parameter will be
created. This allows the full "path" to the unsupported parameter to be reported.

* Build path to the unsupported parameter for error messages.

* Remove unused import

* Update recursive finder test

* Skip if running in check mode

This was done in the _check_arguments() method. That was moved to a function that has no
way of calling fail_json(), so it must be done outside of validation.

This is a silght change in behavior, but I believe the correct one.

Previously, only unsupported parameters would cause a failure. All other checks would not be executed
if the modlue did not support check mode. This would hide validation failures in check mode.

* The great purge

Remove all methods related to argument spec validation from AnsibleModule

* Keep _name and kind in the caller and out of the validator

This seems a bit awkward since this means the caller could end up with {name} and {kind} in
the error message if they don't run the messages through the .format() method
with name and kind parameters.

* Double moustaches work

I wasn't sure if they get stripped or not. Looks like they do. Neat trick.

* Add changelog

* Update unsupported parameter test

The error message changed to include name and kind.

* Remove unused import

* Add better documentation for ArgumentSpecValidator class

* Fix example

* Few more docs fixes

* Mark required and mutually exclusive attributes as private

* Mark validate functions as private

* Reorganize functions in validation.py

* Remove unused imports in basic.py related to argument spec validation

* Create errors is module_utils

We have errors in lib/ansible/errors/ but those cannot be used by modules.

* Update recursive finder test

* Move errors to file rather than __init__.py

* Change ArgumentSpecValidator.validate() interface

Raise AnsibleValidationErrorMultiple on validation error which contains all AnsibleValidationError
exceptions for validation failures.

Return the validated parameters if validation is successful rather than True/False.

Update docs and tests.

* Get attribute in loop so that the attribute name can also be used as a parameter

* Shorten line

* Update calling code in AnsibleModule for new validator interface

* Update calling code in validate_argument_spec based in new validation interface

* Base custom exception class off of Exception

* Call the __init__ method of the base Exception class to populate args

* Ensure no_log values are always updated

* Make custom exceptions more hierarchical

This redefines AnsibleError from lib/ansible/errors with a different signature since that cannot
be used by modules. This may be a bad idea. Maybe lib/ansible/errors should be moved to
module_utils, or AnsibleError defined in this commit should use the same signature as the original.

* Just go back to basing off Exception

* Return ValidationResult object on successful validation

Create a ValidationResult class.
Return a ValidationResult from ArgumentSpecValidator.validate() when validation is successful.
Update class and method docs.
Update unit tests based on interface change.

* Make it easier to get error objects from AnsibleValidationResultMultiple

This makes the interface cleaner when getting individual error objects contained in a single
AnsibleValidationResultMultiple instance.

* Define custom exception for each type of validation failure

These errors indicate where a validation error occured. Currently they are empty but could
contain specific data for each exception type in the future.

* Update tests based on (yet another) interface change

* Mark several more functions as private

These are all doing rather "internal" things. The ArgumentSpecValidator class is the preferred
public interface.

* Move warnings and deprecations to result object

Rather than calling deprecate() and warn() directly, store them on the result object so the
caller can decide what to do with them.

* Use subclass for module arg spec validation

The subclass uses global warning and deprecations feature

* Fix up docs

* Remove legal_inputs munging from _handle_aliases()

This is done in AnsibleModule by the _set_internal_properties() method. It only makes sense
to do that for an AnsibleModule instance (it should update the parameters before performing
validation) and shouldn't be done by the validator.

Create a private function just for getting legal inputs since that is done in a couple of places.

It may make sense store that on the ValidationResult object.

* Increase test coverage

* Remove unnecessary conditional

ci_complete

* Mark warnings and deprecations as private in the ValidationResult

They can be made public once we come up with a way to make them more generally useful,
probably by creating cusom objects to store the data in more structure way.

* Mark valid_parameter_names as private and populate it during initialization

* Use a global for storing the list of additonal checks to perform

This list is used by the main validate method as well as the sub spec validation.
2021-03-19 12:09:18 -07:00
Brian Coca 089d0a0508
find - set proper default based on use_regex (#73961)
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>
2021-03-19 13:18:31 -04:00
Sloane Hertel 48c0fbd1cb
Fix a bug adding unrelated candidates to the plugin loader redirect_list (#73863)
* Fix a bug adding unrelated candidates to the plugin loader redirect_list

* Add tests for the redirect list

  * test redirect list for builtin module
  * test redirect list for redirected builtin module
  * test redirect list for collection module
  * test redirect list for redirected collection module
  * test redirect list for legacy module

* changelog
2021-03-18 17:53:57 -04:00
Baptiste Mille-Mathias 3e63eb8418 fix typo 2021-03-18 12:50:06 -07:00
Abhijeet Kasurde 3811fddede Amazon: Fix distribution facts for older release
Ansible can gather distribution facts for older Amazon Linux
with /etc/os-release data.

Fixes: #73946

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-03-18 12:42:04 -07:00
s-hertel ad5ee1542a Remove ini and env fields for config option CONNECTION_FACTS_MODULES 2021-03-18 12:40:15 -07:00