1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Don't pass file_name to DataLoader.load in script inventory plugin (#45428)

* Don't pass file_name to DataLoader.load in script inventory plugin. Fixes #34164

* Add changelog fragment
This commit is contained in:
Matt Martz 2018-09-10 14:37:18 -05:00 committed by GitHub
parent aa01d9d243
commit 263b9fade8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- script inventory plugin - Don't pass file_name to DataLoader.load, which will prevent misleading error messages (https://github.com/ansible/ansible/issues/34164)

View file

@ -120,7 +120,7 @@ class InventoryModule(BaseInventoryPlugin, Cacheable):
raise AnsibleError("Inventory {0} contained characters that cannot be interpreted as UTF-8: {1}".format(path, to_native(e)))
try:
self._cache[cache_key] = self.loader.load(data, file_name=path)
self._cache[cache_key] = self.loader.load(data)
except Exception as e:
raise AnsibleError("failed to parse executable inventory script results from {0}: {1}\n{2}".format(path, to_native(e), err))