From 24d7555d0b6a59ec360dcc39eafd4bcbd976a2f6 Mon Sep 17 00:00:00 2001 From: Robin Roth Date: Mon, 10 Oct 2016 14:59:16 +0200 Subject: [PATCH] Allow unicode inventory filename Fixes #17932 (cherry picked from commit 392232895491aca2e4f65331131103f4f2ea5b7d) --- lib/ansible/inventory/dir.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/inventory/dir.py b/lib/ansible/inventory/dir.py index bb25a271212..c284dcf1b51 100644 --- a/lib/ansible/inventory/dir.py +++ b/lib/ansible/inventory/dir.py @@ -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))