From 9c9ef0d6ab95e2d983720b6a27d8021cfbdce168 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Fri, 24 Mar 2017 21:18:48 -0700 Subject: [PATCH] Fix a few problems with the metadata extraction for docs (#22963) * key is ANSIBLE_METADATA, not METADATA * Need to check that the node is an ast.Dict, not a real dict. * Need to convert the ast.Dict into a real dict via literal_eval. --- lib/ansible/utils/plugin_docs.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/utils/plugin_docs.py b/lib/ansible/utils/plugin_docs.py index e13b2a6d158..dd38cfa953d 100644 --- a/lib/ansible/utils/plugin_docs.py +++ b/lib/ansible/utils/plugin_docs.py @@ -113,7 +113,7 @@ def get_docstring(filename, verbose=False): 'DOCUMENTATION': 'doc', 'EXAMPLES': 'plainexamples', 'RETURN': 'returndocs', - 'METADATA': 'metadata' + 'ANSIBLE_METADATA': 'metadata' } try: @@ -142,10 +142,10 @@ def get_docstring(filename, verbose=False): if theid in string_to_vars: varkey = string_to_vars[theid] - if isinstance(child.value, MutableMapping): - data[varkey] = child.value + if isinstance(child.value, ast.Dict): + data[varkey] = ast.literal_eval(child.value) else: - if theid in ['DOCUMENTATION', 'METADATA']: + if theid in ['DOCUMENTATION', 'ANSIBLE_METADATA']: # string should be yaml data[varkey] = AnsibleLoader(child.value.s, file_name=filename).get_single_data() else: