From e2c60cee8000467b665a642c51f943aeeef8f63b Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Fri, 9 Jul 2021 18:23:19 +0200 Subject: [PATCH] Do not show empty version_added_collection values in ansible-doc text output. (#74999) (#75004) (cherry picked from commit 58450f041a6ffc343e5d19569580f5189e09200c) --- .../fragments/74999-ansible-doc-version_added_collection.yml | 2 ++ lib/ansible/cli/doc.py | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 changelogs/fragments/74999-ansible-doc-version_added_collection.yml diff --git a/changelogs/fragments/74999-ansible-doc-version_added_collection.yml b/changelogs/fragments/74999-ansible-doc-version_added_collection.yml new file mode 100644 index 00000000000..54b86120f01 --- /dev/null +++ b/changelogs/fragments/74999-ansible-doc-version_added_collection.yml @@ -0,0 +1,2 @@ +bugfixes: +- "ansible-doc - in text output, do not show empty ``version_added_collection`` values (https://github.com/ansible/ansible/pull/74999)." diff --git a/lib/ansible/cli/doc.py b/lib/ansible/cli/doc.py index 41baa796653..ac1bf38a8d2 100644 --- a/lib/ansible/cli/doc.py +++ b/lib/ansible/cli/doc.py @@ -599,6 +599,10 @@ class DocCLI(CLI): if conf: text.append(DocCLI._dump_yaml({'set_via': conf}, opt_indent)) + # Remove empty version_added_collection + if opt.get('version_added_collection') == '': + opt.pop('version_added_collection') + for k in sorted(opt): if k.startswith('_'): continue