diff options
author | AlanCoding <arominge@redhat.com> | 2019-01-21 11:21:12 -0500 |
---|---|---|
committer | Brian Coca <bcoca@users.noreply.github.com> | 2019-01-22 17:33:20 -0500 |
commit | f018b9d07dac91cba2961f8dd2bce900f651c781 (patch) | |
tree | cdb17ec80066d2a9b4be7c57bdadcdf0ff95d47d /lib/ansible/inventory | |
parent | 214b4407aaf873dd5999dec0f02d3a6fefb41a5e (diff) | |
download | ansible-f018b9d07dac91cba2961f8dd2bce900f651c781.tar.gz |
Fix missing tracebacks in ansible-inventory
(cherry picked from commit b62693299b3d561c9a0a78c6c8e440f3c623b5d1)
Diffstat (limited to 'lib/ansible/inventory')
-rw-r--r-- | lib/ansible/inventory/manager.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/ansible/inventory/manager.py b/lib/ansible/inventory/manager.py index de2041a68f..abe4ced438 100644 --- a/lib/ansible/inventory/manager.py +++ b/lib/ansible/inventory/manager.py @@ -21,8 +21,10 @@ __metaclass__ = type import fnmatch import os +import sys import re import itertools +import traceback from operator import attrgetter from random import shuffle @@ -273,6 +275,9 @@ class InventoryManager(object): break except AnsibleParserError as e: display.debug('%s was not parsable by %s' % (source, plugin_name)) + # Ansible error was created before the exception has been processed, + # so traceback can only be obtained within this context + e.tb = ''.join(traceback.format_tb(sys.exc_info()[2])) failures.append({'src': source, 'plugin': plugin_name, 'exc': e}) except Exception as e: display.debug('%s failed to parse %s' % (plugin_name, source)) |