1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix encoding issue when parsing plugin examples

This caused a non-fatal traceback when building, for example, the module
documentation for the debug module.
This commit is contained in:
Toshio Kuratomi 2018-05-01 22:39:14 -07:00
parent 2397ca1a7e
commit 3e64036684
2 changed files with 5 additions and 1 deletions

View file

@ -0,0 +1,3 @@
---
bugfixes:
- Fix an encoding issue when parsing the examples from a plugins' documentation

View file

@ -8,6 +8,7 @@ __metaclass__ = type
import ast
import yaml
from ansible.module_utils._text import to_text
from ansible.parsing.metadata import extract_metadata
from ansible.parsing.yaml.loader import AnsibleLoader
@ -61,7 +62,7 @@ def read_docstring(filename, verbose=True, ignore_errors=True):
data[varkey] = AnsibleLoader(child.value.s, file_name=filename).get_single_data()
else:
# not yaml, should be a simple string
data[varkey] = child.value.s
data[varkey] = to_text(child.value.s)
display.debug('assigned :%s' % varkey)
# Metadata is per-file and a dict rather than per-plugin/function and yaml