Changes to convert to unicode at the borders

The module docs and vault changes solve issues where tracebacks can
happen.  The galaxy changes are mostly refactoring to be more pythonic
with a small chance that a unicode traceback could have occurred there
without the changes.  The change in __init__.py when we actually call
the pager makes things more robust but could hide places where we had
bytes coming in already so I didn't want to change that without auditing
where the text was coming from.

Fixes #14178
This commit is contained in:
Toshio Kuratomi 2016-01-28 10:50:20 -08:00
parent e7a9031d61
commit fa9822df0f
4 changed files with 31 additions and 20 deletions

View file

@ -24,7 +24,7 @@ __metaclass__ = type
import os
import sys
import ast
import yaml
from ansible.parsing.yaml.loader import AnsibleLoader
import traceback
from collections import MutableMapping, MutableSet, MutableSequence
@ -71,7 +71,7 @@ def get_docstring(filename, verbose=False):
continue
if 'DOCUMENTATION' in theid:
doc = yaml.safe_load(child.value.s)
doc = AnsibleLoader(child.value.s, file_name=filename).get_single_data()
fragments = doc.get('extends_documentation_fragment', [])
if isinstance(fragments, basestring):
@ -91,7 +91,7 @@ def get_docstring(filename, verbose=False):
assert fragment_class is not None
fragment_yaml = getattr(fragment_class, fragment_var, '{}')
fragment = yaml.safe_load(fragment_yaml)
fragment = AnsibleLoader(fragment_yaml, file_name=filename).get_single_data()
if fragment.has_key('notes'):
notes = fragment.pop('notes')