Fix missing tracebacks in ansible-inventory

pull/51136/head
AlanCoding 6 years ago
parent c9bc47b354
commit b62693299b
No known key found for this signature in database
GPG Key ID: FD2C3C012A72926B

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