Allow unicode inventory filename

Fixes #17932

(cherry picked from commit 3922328954)
This commit is contained in:
Robin Roth 2016-10-10 14:59:16 +02:00 committed by Toshio Kuratomi
parent d3dd82f3cf
commit 24d7555d0b

View file

@ -70,7 +70,7 @@ def get_file_parser(hostsfile, groups, loader):
parser = InventoryYAMLParser(loader=loader, groups=groups, filename=hostsfile)
processed = True
except Exception as e:
myerr.append('Attempted to read "%s" as YAML: %s' % (hostsfile, to_native(e)))
myerr.append('Attempted to read "%s" as YAML: %s' % (to_native(hostsfile), to_native(e)))
# ini
if not processed and not shebang_present:
@ -78,7 +78,7 @@ def get_file_parser(hostsfile, groups, loader):
parser = InventoryINIParser(loader=loader, groups=groups, filename=hostsfile)
processed = True
except Exception as e:
myerr.append('Attempted to read "%s" as ini file: %s ' % (hostsfile, to_native(e)))
myerr.append('Attempted to read "%s" as ini file: %s ' % (to_native(hostsfile), to_native(e)))
if not processed and myerr:
raise AnsibleError('\n'.join(myerr))