filter: Misc fixes in docs (#82823)

* misc fixes for the filter documentation

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/81976/merge
Abhijeet Kasurde 3 months ago committed by GitHub
parent 1181436d54
commit 2806758793
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2,28 +2,28 @@ DOCUMENTATION:
name: b64decode name: b64decode
author: ansible core team author: ansible core team
version_added: 'historical' version_added: 'historical'
short_description: Decode a base64 string short_description: Decode a Base64 string
description: description:
- Base64 decoding function. - Base64 decoding function.
- The return value is a string. - The return value is a string.
- Trying to store a binary blob in a string most likely corrupts the binary. To base64 decode a binary blob, - Trying to store a binary blob in a string most likely corrupts the binary. To Base64 decode a binary blob,
use the ``base64`` command and pipe the encoded data through standard input. use the I(base64) command and pipe the encoded data through standard input.
For example, in the ansible.builtin.shell`` module, ``cmd="base64 --decode > myfile.bin" stdin="{{ encoded }}"``. For example, in the M(ansible.builtin.shell) module, ``cmd="base64 --decode > myfile.bin" stdin="{{ encoded }}"``.
positional: _input positional: _input
options: options:
_input: _input:
description: A base64 string to decode. description: A Base64 string to decode.
type: string type: string
required: true required: true
EXAMPLES: | EXAMPLES: |
# b64 decode a string # Base64 decode a string
lola: "{{ 'bG9sYQ==' | b64decode }}" lola: "{{ 'bG9sYQ==' | b64decode }}"
# b64 decode the content of 'b64stuff' variable # Base64 decode the content of 'b64stuff' variable
stuff: "{{ b64stuff | b64decode }}" stuff: "{{ b64stuff | b64decode }}"
RETURN: RETURN:
_value: _value:
description: The contents of the base64 encoded string. description: The contents of the Base64 encoded string.
type: string type: string

@ -2,7 +2,7 @@ DOCUMENTATION:
name: b64encode name: b64encode
author: ansible core team author: ansible core team
version_added: 'historical' version_added: 'historical'
short_description: Encode a string as base64 short_description: Encode a string as Base64
description: description:
- Base64 encoding function. - Base64 encoding function.
positional: _input positional: _input
@ -13,13 +13,13 @@ DOCUMENTATION:
required: true required: true
EXAMPLES: | EXAMPLES: |
# b64 encode a string # Base64 encode a string
b64lola: "{{ 'lola'| b64encode }}" b64lola: "{{ 'lola'| b64encode }}"
# b64 encode the content of 'stuff' variable # Base64 encode the content of 'stuff' variable
b64stuff: "{{ stuff | b64encode }}" b64stuff: "{{ stuff | b64encode }}"
RETURN: RETURN:
_value: _value:
description: A base64 encoded string. description: A Base64 encoded string.
type: string type: string

@ -592,7 +592,7 @@ def commonpath(paths):
:rtype: str :rtype: str
""" """
if not is_sequence(paths): if not is_sequence(paths):
raise AnsibleFilterTypeError("|path_join expects sequence, got %s instead." % type(paths)) raise AnsibleFilterTypeError("|commonpath expects sequence, got %s instead." % type(paths))
return os.path.commonpath(paths) return os.path.commonpath(paths)

Loading…
Cancel
Save