From ce08b4165dc3b269eb701385b1d8b735b23bf86b Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Fri, 24 Feb 2017 20:58:19 -0500 Subject: [PATCH] ansible-doc more flexible to metadata changes --- lib/ansible/cli/doc.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/ansible/cli/doc.py b/lib/ansible/cli/doc.py index 86a90477c36..1a5f0a23c92 100644 --- a/lib/ansible/cli/doc.py +++ b/lib/ansible/cli/doc.py @@ -269,13 +269,13 @@ class DocCLI(CLI): if 'deprecated' in doc and doc['deprecated'] is not None and len(doc['deprecated']) > 0: text.append("DEPRECATED: \n%s\n" % doc['deprecated']) - metadata = doc['metadata'] - - supported_by = metadata['supported_by'] - text.append("Supported by: %s\n" % supported_by) - - status = metadata['status'] - text.append("Status: %s\n" % ", ".join(status)) + if doc['metadata'] and isinstance(doc['metadata'], dict): + text.append("Metadata:") + for k in doc['metadata']: + if isinstance(k, list): + text.append("\t%s: %s\n" % (k.capitalize(), ", ".join(doc['metadata'][k]))) + else: + text.append("\t%s: %s\n" % (k.capitalize(), doc['metadata'][k])) if 'action' in doc and doc['action']: text.append(" * note: %s\n" % "This module has a corresponding action plugin.")