mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 22:00:22 -07:00
Add option to ignore, warn, or error when a module parameter is converted to a string (#51404)
* Add new module property to Windows modules * Add brief pause to file tests to ensure the stat times are not equal, which was happening sometimes. * Raise TypeError on error rather than fail_json() * Rework error message to be less verbose * Add porting guide entry
This commit is contained in:
parent
1f06b3ca7d
commit
f52a088862
7 changed files with 49 additions and 8 deletions
|
@ -50,16 +50,22 @@ In Ansible 2.8::
|
|||
In Ansible 2.7 and older::
|
||||
|
||||
{{ ((foo | default({})).bar | default({})).baz | default('DEFAULT') }}
|
||||
|
||||
|
||||
or
|
||||
|
||||
|
||||
{{ foo.bar.baz if (foo is defined and foo.bar is defined and foo.bar.baz is defined) else 'DEFAULT' }}
|
||||
|
||||
Module option conversion to string
|
||||
----------------------------------
|
||||
|
||||
Beginning in version 2.8, Ansible will warn if a module expects a string, but a non-string value is passed and automatically converted to a string. This highlights potential problems where, for example, a ``yes`` or ``true`` (parsed as truish boolean value) would be converted to the string ``'True'``, or where a version number ``1.10`` (parsed as float value) would be converted to ``'1.0'``. Such conversions can result in unexpected behavior depending on context.
|
||||
|
||||
This behavior can be changed to be an error or to be ignored by setting the ``ANSIBLE_STRING_CONVERSION_ACTION`` environment variable, or by setting the ``string_conversion_action`` configuration in the ``defaults`` section of ``ansible.cfg``.
|
||||
|
||||
Command line facts
|
||||
------------------
|
||||
|
||||
``cmdline`` facts returned in system will be deprecated in favor of ``proc_cmdline``. This change handles special case where Kernel command line parameter
|
||||
contains multiple values with the same key.
|
||||
``cmdline`` facts returned in system will be deprecated in favor of ``proc_cmdline``. This change handles special case where Kernel command line parameter contains multiple values with the same key.
|
||||
|
||||
Command Line
|
||||
============
|
||||
|
@ -122,7 +128,6 @@ PowerShell module options and option choices are currently case insensitive to w
|
|||
specification. This behaviour is deprecated and a warning displayed to the user if a case insensitive match was found.
|
||||
A future release of Ansible will make these checks case sensitive.
|
||||
|
||||
|
||||
Modules removed
|
||||
---------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue