summaryrefslogtreecommitdiff
path: root/lib/ansible/cli
diff options
context:
space:
mode:
authorAbhijeet Kasurde <akasurde@redhat.com>2019-11-12 16:48:46 +0530
committerGitHub <noreply@github.com>2019-11-12 16:48:46 +0530
commit575116a584b5bb2fcfa3270611677f37d18295a8 (patch)
tree0717fda193a8fb5391aeeb83efed7cf511951099 /lib/ansible/cli
parent4bf79de8a65b5bb8bddeff3d328adbd49a8dd19b (diff)
downloadansible-575116a584b5bb2fcfa3270611677f37d18295a8.tar.gz
doc: Handle exception in parsing parameter description (#60933)
Fixes: #60587 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Diffstat (limited to 'lib/ansible/cli')
-rw-r--r--lib/ansible/cli/doc.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/ansible/cli/doc.py b/lib/ansible/cli/doc.py
index f7878ff4e9..12bb590fb4 100644
--- a/lib/ansible/cli/doc.py
+++ b/lib/ansible/cli/doc.py
@@ -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']