From 1e06a9f48d85d699d03622981bc44e3141e57fff Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Fri, 1 Apr 2016 17:43:22 -0400 Subject: [PATCH] verifies required is a boolean --- lib/ansible/cli/doc.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/ansible/cli/doc.py b/lib/ansible/cli/doc.py index 950e3d78fc..65b4327aea 100644 --- a/lib/ansible/cli/doc.py +++ b/lib/ansible/cli/doc.py @@ -219,7 +219,10 @@ class DocCLI(CLI): opt = doc['options'][o] desc = CLI.tty_ify(" ".join(opt['description'])) - if opt.get('required', False): + required = opt.get('required', False) + if not isinstance(required, bool): + raise("Incorrect value for 'Required', a boolean is needed.: %s" % required) + if required: s = o + "=" else: s = o @@ -252,7 +255,10 @@ class DocCLI(CLI): for o in sorted(doc['option_keys']): opt = doc['options'][o] - if opt.get('required', False): + required = opt.get('required', False) + if not isinstance(required, bool): + raise("Incorrect value for 'Required', a boolean is needed.: %s" % required) + if required: opt_leadin = "=" else: opt_leadin = "-"