From 3e6403668460d24fecc9cb7f6bd44ce3b5d91741 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Tue, 1 May 2018 22:39:14 -0700 Subject: [PATCH] Fix encoding issue when parsing plugin examples This caused a non-fatal traceback when building, for example, the module documentation for the debug module. --- changelogs/fragments/encoding-docs-plugin-parsing.yaml | 3 +++ lib/ansible/parsing/plugin_docs.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/encoding-docs-plugin-parsing.yaml diff --git a/changelogs/fragments/encoding-docs-plugin-parsing.yaml b/changelogs/fragments/encoding-docs-plugin-parsing.yaml new file mode 100644 index 0000000000..5dc89a7634 --- /dev/null +++ b/changelogs/fragments/encoding-docs-plugin-parsing.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: +- Fix an encoding issue when parsing the examples from a plugins' documentation diff --git a/lib/ansible/parsing/plugin_docs.py b/lib/ansible/parsing/plugin_docs.py index 267d612627..797e87f440 100644 --- a/lib/ansible/parsing/plugin_docs.py +++ b/lib/ansible/parsing/plugin_docs.py @@ -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