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.
This commit is contained in:
parent
dfe8eca3d2
commit
9c9ef0d6ab
1 changed files with 4 additions and 4 deletions
|
@ -113,7 +113,7 @@ def get_docstring(filename, verbose=False):
|
||||||
'DOCUMENTATION': 'doc',
|
'DOCUMENTATION': 'doc',
|
||||||
'EXAMPLES': 'plainexamples',
|
'EXAMPLES': 'plainexamples',
|
||||||
'RETURN': 'returndocs',
|
'RETURN': 'returndocs',
|
||||||
'METADATA': 'metadata'
|
'ANSIBLE_METADATA': 'metadata'
|
||||||
}
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -142,10 +142,10 @@ def get_docstring(filename, verbose=False):
|
||||||
|
|
||||||
if theid in string_to_vars:
|
if theid in string_to_vars:
|
||||||
varkey = string_to_vars[theid]
|
varkey = string_to_vars[theid]
|
||||||
if isinstance(child.value, MutableMapping):
|
if isinstance(child.value, ast.Dict):
|
||||||
data[varkey] = child.value
|
data[varkey] = ast.literal_eval(child.value)
|
||||||
else:
|
else:
|
||||||
if theid in ['DOCUMENTATION', 'METADATA']:
|
if theid in ['DOCUMENTATION', 'ANSIBLE_METADATA']:
|
||||||
# string should be yaml
|
# string should be yaml
|
||||||
data[varkey] = AnsibleLoader(child.value.s, file_name=filename).get_single_data()
|
data[varkey] = AnsibleLoader(child.value.s, file_name=filename).get_single_data()
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue