Encoding fixes for plugin loader and vault. (#51002)

pull/51034/head
Matt Clay 5 years ago committed by Brian Coca
parent 9fa46e7f94
commit a864247bd5

@ -234,7 +234,7 @@ class CLI(with_metaclass(ABCMeta, object)):
try:
file_vault_secret.load()
except AnsibleError as exc:
display.warning('Error in vault password file loading (%s): %s' % (vault_id_name, exc))
display.warning('Error in vault password file loading (%s): %s' % (vault_id_name, to_text(exc)))
raise
if vault_id_name:

@ -352,7 +352,7 @@ class PluginLoader:
warnings.simplefilter("ignore", RuntimeWarning)
with open(to_bytes(path), 'rb') as module_file:
# to_native is used here because imp.load_source's path is for tracebacks and python's traceback formatting uses native strings
module = imp.load_source(full_name, to_native(path), module_file)
module = imp.load_source(to_native(full_name), to_native(path), module_file)
return module
def _update_object(self, obj, name, path):
@ -622,7 +622,7 @@ def _load_plugin_filter():
if 'stat' in filters['ansible.modules']:
raise AnsibleError('The stat module was specified in the module blacklist file, {0}, but'
' Ansible will not function without the stat module. Please remove stat'
' from the blacklist.'.format(filter_cfg))
' from the blacklist.'.format(to_native(filter_cfg)))
return filters

Loading…
Cancel
Save