doc: Handle exception in parsing parameter description (#60933)
Fixes: #60587 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
4bf79de8a6
commit
575116a584
2 changed files with 7 additions and 1 deletions
2
changelogs/fragments/60587-doc_parsing.yml
Normal file
2
changelogs/fragments/60587-doc_parsing.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- Handle exception encountered while parsing the argument description in module when invoked via ansible-doc command (https://github.com/ansible/ansible/issues/60587).
|
|
@ -507,9 +507,13 @@ class DocCLI(CLI):
|
|||
text.append("%s %s" % (opt_leadin, o))
|
||||
|
||||
if isinstance(opt['description'], list):
|
||||
for entry in opt['description']:
|
||||
for entry_idx, entry in enumerate(opt['description'], 1):
|
||||
if not isinstance(entry, string_types):
|
||||
raise AnsibleError("Expected string in description of %s at index %s, got %s" % (o, entry_idx, type(entry)))
|
||||
text.append(textwrap.fill(DocCLI.tty_ify(entry), limit, initial_indent=opt_indent, subsequent_indent=opt_indent))
|
||||
else:
|
||||
if not isinstance(opt['description'], string_types):
|
||||
raise AnsibleError("Expected string in description of %s, got %s" % (o, type(opt['description'])))
|
||||
text.append(textwrap.fill(DocCLI.tty_ify(opt['description']), limit, initial_indent=opt_indent, subsequent_indent=opt_indent))
|
||||
del opt['description']
|
||||
|
||||
|
|
Loading…
Reference in a new issue