From 0766ad33eb26f950b85e8df5b3e3de233b78d305 Mon Sep 17 00:00:00 2001 From: Sandra McCann Date: Fri, 23 Jun 2023 16:11:44 -0400 Subject: [PATCH] Core backportapalooza 06 22 (#81111) * Fix typo in comment filter option (#80672) (cherry picked from commit 40fd86c618fecb8d98364f33be03b19d4071c159) * Documentation tweaks for apt repo key management. Fixes #78063 (#80872) (cherry picked from commit 0775e991d51e2fe9c38a4d862cd32a9f704d4915) * Update split.yml (#80915) typo in description (cherry picked from commit 6011b7c4c19b9bd45f3fe78634feee4cc5c9c499) * Correct syntax error in the example (#80976) * Update success.yml * Update reachable.yml * Update unreachable.yml (cherry picked from commit d210260afc71af030a7ed6304b9596fc3dd7fbb2) * Update manager.py (#80926) (cherry picked from commit e91bf2248f81481f1210d7da1681879fb0681556) * Added link to argument_spec (#80967) (cherry picked from commit 9e14a85fe38631714b3a4e1a4ef1ab74ab63b430) * modules/find: param contains: Describe matching behavior (#80744) (cherry picked from commit a473bb798da169719ba40480b5a80b3f586969f8) * Update example in apt_key module (#81017) * Verify checksum of downloaded key Fixes: #79892 Signed-off-by: Abhijeet Kasurde (cherry picked from commit ce55e0faf5911d267fc7c649ff3d6304657ccb25) * Fix typo in to_yaml filter examples (#81094) (cherry picked from commit 1f9836fe9a417dd4dec9fcc7c7d45a11ee831d1f) --------- Co-authored-by: Chris van Meer Co-authored-by: Matt Martz Co-authored-by: F-Baker <35278989+F-Baker@users.noreply.github.com> Co-authored-by: Vlad Glagolev Co-authored-by: David-Ademola <131247654+David-Ademola@users.noreply.github.com> Co-authored-by: tachyontec <92679798+tachyontec@users.noreply.github.com> Co-authored-by: Felix Stupp Co-authored-by: Abhijeet Kasurde Co-authored-by: Giovanni Toraldo --- lib/ansible/config/manager.py | 2 +- lib/ansible/modules/apt_key.py | 13 ++++++++----- lib/ansible/modules/apt_repository.py | 2 ++ lib/ansible/modules/find.py | 3 +++ lib/ansible/modules/validate_argument_spec.py | 2 +- lib/ansible/plugins/filter/comment.yml | 2 +- lib/ansible/plugins/filter/split.yml | 2 +- lib/ansible/plugins/filter/to_yaml.yml | 2 +- lib/ansible/plugins/test/changed.yml | 2 +- lib/ansible/plugins/test/reachable.yml | 2 +- lib/ansible/plugins/test/success.yml | 2 +- lib/ansible/plugins/test/unreachable.yml | 2 +- 12 files changed, 22 insertions(+), 14 deletions(-) diff --git a/lib/ansible/config/manager.py b/lib/ansible/config/manager.py index bcb98047d46..30a06459d27 100644 --- a/lib/ansible/config/manager.py +++ b/lib/ansible/config/manager.py @@ -63,7 +63,7 @@ def ensure_type(value, value_type, origin=None): :temppath: Same as 'tmppath' :tmp: Same as 'tmppath' :pathlist: Treat the value as a typical PATH string. (On POSIX, this - means colon separated strings.) Split the value and then expand + means comma separated strings.) Split the value and then expand each part for environment variables and tildes. :pathspec: Treat the value as a PATH string. Expands any environment variables tildes's in the value. diff --git a/lib/ansible/modules/apt_key.py b/lib/ansible/modules/apt_key.py index 94b969030d1..743b345aa9b 100644 --- a/lib/ansible/modules/apt_key.py +++ b/lib/ansible/modules/apt_key.py @@ -27,7 +27,7 @@ attributes: platform: platforms: debian notes: - - The apt-key command has been deprecated and suggests to 'manage keyring files in trusted.gpg.d instead'. See the Debian wiki for details. + - The apt-key command used by this module has been deprecated. See the L(Debian wiki,https://wiki.debian.org/DebianRepository/UseThirdParty) for details. This module is kept for backwards compatibility for systems that still use apt-key as the main way to manage apt repository keys. - As a sanity check, downloaded key id must match the one specified. - "Use full fingerprint (40 characters) key ids to avoid key collisions. @@ -36,6 +36,8 @@ notes: - Adding a new key requires an apt cache update (e.g. using the M(ansible.builtin.apt) module's update_cache option). requirements: - gpg +seealso: + - module: ansible.builtin.deb822_repository options: id: description: @@ -81,12 +83,13 @@ options: ''' EXAMPLES = ''' -- name: One way to avoid apt_key once it is removed from your distro +- name: One way to avoid apt_key once it is removed from your distro, armored keys should use .asc extension, binary should use .gpg block: - - name: somerepo |no apt key + - name: somerepo | no apt key ansible.builtin.get_url: - url: https://download.example.com/linux/ubuntu/gpg - dest: /etc/apt/keyrings/somerepo.asc + url: https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x36a1d7869245c8950f966e92d8576a8ba88d21e9 + dest: /etc/apt/keyrings/myrepo.asc + checksum: sha256:bb42f0db45d46bab5f9ec619e1a47360b94c27142e57aa71f7050d08672309e0 - name: somerepo | apt source ansible.builtin.apt_repository: diff --git a/lib/ansible/modules/apt_repository.py b/lib/ansible/modules/apt_repository.py index cbd837417e9..4f7fbc0551d 100644 --- a/lib/ansible/modules/apt_repository.py +++ b/lib/ansible/modules/apt_repository.py @@ -26,6 +26,8 @@ attributes: platforms: debian notes: - This module supports Debian Squeeze (version 6) as well as its successors and derivatives. +seealso: + - module: ansible.builtin.deb822_repository options: repo: description: diff --git a/lib/ansible/modules/find.py b/lib/ansible/modules/find.py index b13c841cc2f..dcc9e11e2f5 100644 --- a/lib/ansible/modules/find.py +++ b/lib/ansible/modules/find.py @@ -56,6 +56,9 @@ options: contains: description: - A regular expression or pattern which should be matched against the file content. + - If I(read_whole_file) is C(true) it matches against the beginning of the line (uses + C(re.match())). If I(read_whole_file) is C(false), it searches anywhere for that pattern + (uses C(re.search())). - Works only when I(file_type) is C(file). type: str read_whole_file: diff --git a/lib/ansible/modules/validate_argument_spec.py b/lib/ansible/modules/validate_argument_spec.py index 744f1457b53..0c37802c591 100644 --- a/lib/ansible/modules/validate_argument_spec.py +++ b/lib/ansible/modules/validate_argument_spec.py @@ -17,7 +17,7 @@ version_added: "2.11" options: argument_spec: description: - - A dictionary like AnsibleModule argument_spec + - A dictionary like AnsibleModule argument_spec. See R(argument spec definition,argument_spec) required: true provided_arguments: description: diff --git a/lib/ansible/plugins/filter/comment.yml b/lib/ansible/plugins/filter/comment.yml index 95a4efb08e1..f1e47e6d087 100644 --- a/lib/ansible/plugins/filter/comment.yml +++ b/lib/ansible/plugins/filter/comment.yml @@ -38,7 +38,7 @@ DOCUMENTATION: postfix: description: Indicator of the end of each line inside a comment block, only available for styles that support multiline comments. type: string - protfix_count: + postfix_count: description: Number of times to add a postfix at the end of a line, when a prefix exists and is usable. type: int default: 1 diff --git a/lib/ansible/plugins/filter/split.yml b/lib/ansible/plugins/filter/split.yml index ca9ab72853e..ceaa84bd9ad 100644 --- a/lib/ansible/plugins/filter/split.yml +++ b/lib/ansible/plugins/filter/split.yml @@ -3,7 +3,7 @@ DOCUMENTATION: version_added: "historical" short_description: split a string into a list description: - - Using Python's text object method C(split) we turn strings into lists via a 'spliting character'. + - Using Python's text object method C(split) we turn strings into lists via a 'splitting character'. notes: - This is a passthrough to Python's C(str.split). positional: _input, _split_string diff --git a/lib/ansible/plugins/filter/to_yaml.yml b/lib/ansible/plugins/filter/to_yaml.yml index d2fc9d7e9dc..fef6449adfb 100644 --- a/lib/ansible/plugins/filter/to_yaml.yml +++ b/lib/ansible/plugins/filter/to_yaml.yml @@ -44,7 +44,7 @@ EXAMPLES: | {{ github_workflow |to_yaml}} # same as above but 'prettier' (equivalent to to_nice_yaml filter) - {{ docker_config|to_json(indent=4) }} + {{ docker_config|to_yaml(indent=4) }} RETURN: _value: diff --git a/lib/ansible/plugins/test/changed.yml b/lib/ansible/plugins/test/changed.yml index 1fb1e5e8a01..479f407e60c 100644 --- a/lib/ansible/plugins/test/changed.yml +++ b/lib/ansible/plugins/test/changed.yml @@ -14,7 +14,7 @@ DOCUMENTATION: required: True EXAMPLES: | # test 'status' to know how to respond - {{ (taskresults is changed }} + {{ taskresults is changed }} RETURN: _value: diff --git a/lib/ansible/plugins/test/reachable.yml b/lib/ansible/plugins/test/reachable.yml index 8cb1ce30f29..562814249ce 100644 --- a/lib/ansible/plugins/test/reachable.yml +++ b/lib/ansible/plugins/test/reachable.yml @@ -13,7 +13,7 @@ DOCUMENTATION: required: True EXAMPLES: | # test 'status' to know how to respond - {{ (taskresults is reachable }} + {{ taskresults is reachable }} RETURN: _value: diff --git a/lib/ansible/plugins/test/success.yml b/lib/ansible/plugins/test/success.yml index 4626f9fe53a..6d9f3627a24 100644 --- a/lib/ansible/plugins/test/success.yml +++ b/lib/ansible/plugins/test/success.yml @@ -14,7 +14,7 @@ DOCUMENTATION: required: True EXAMPLES: | # test 'status' to know how to respond - {{ (taskresults is success }} + {{ taskresults is success }} RETURN: _value: diff --git a/lib/ansible/plugins/test/unreachable.yml b/lib/ansible/plugins/test/unreachable.yml index ed6c17e72f1..90b057f4bd5 100644 --- a/lib/ansible/plugins/test/unreachable.yml +++ b/lib/ansible/plugins/test/unreachable.yml @@ -13,7 +13,7 @@ DOCUMENTATION: required: True EXAMPLES: | # test 'status' to know how to respond - {{ (taskresults is unreachable }} + {{ taskresults is unreachable }} RETURN: _value: