mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-05 12:52:48 +00:00
Fix missing tracebacks in ansible-inventory
(cherry picked from commit b62693299b3d561c9a0a78c6c8e440f3c623b5d1)
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user