From 6d17736ef45cbb81bdcbafd5b52dc45f75535baf Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Tue, 18 Aug 2020 21:33:28 +0530 Subject: [PATCH] subelements: Clarify parameter docs (#71177) skip_missing parameter in subelements lookup plugin is accepted from inside the dictionary. Fixes: #38182 Signed-off-by: Abhijeet Kasurde --- changelogs/fragments/38182_subelements.yml | 2 ++ lib/ansible/plugins/lookup/subelements.py | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/38182_subelements.yml diff --git a/changelogs/fragments/38182_subelements.yml b/changelogs/fragments/38182_subelements.yml new file mode 100644 index 00000000000..9a2a6be462a --- /dev/null +++ b/changelogs/fragments/38182_subelements.yml @@ -0,0 +1,2 @@ +minor_changes: +- subelements - clarify the lookup plugin documentation for parameter handling (https://github.com/ansible/ansible/issues/38182). diff --git a/lib/ansible/plugins/lookup/subelements.py b/lib/ansible/plugins/lookup/subelements.py index 9212d820dde..a948f0204ef 100644 --- a/lib/ansible/plugins/lookup/subelements.py +++ b/lib/ansible/plugins/lookup/subelements.py @@ -18,8 +18,9 @@ DOCUMENTATION = """ skip_missing: default: False description: - - If set to True, the lookup plugin will skip the lists items that do not contain the given subkey. - If False, the plugin will yield an error and complain about the missing subkey. + - Lookup accepts this flag from a dictionary as optional. See Example section for more information. + - If set to C(True), the lookup plugin will skip the lists items that do not contain the given subkey. + - If set to C(False), the plugin will yield an error and complain about the missing subkey. """ EXAMPLES = """ @@ -74,7 +75,7 @@ EXAMPLES = """ - name: list groups for users that have them, don't error if groups key is missing debug: var=item - loop: "{{lookup('subelements', users, 'groups', {'skip_missing': True})}}" + loop: "{{ q('subelements', users, 'groups', {'skip_missing': True}) }}" """ RETURN = """