Fix missing tracebacks in ansible-inventory

(cherry picked from commit b62693299b)
pull/51198/head
AlanCoding 6 years ago committed by Brian Coca
parent 214b4407aa
commit f018b9d07d

@ -0,0 +1,2 @@
bugfixes:
- Fix bug where some inventory parsing tracebacks were missing or reported under the wrong plugin.

@ -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))

Loading…
Cancel
Save