mirror of
https://github.com/ansible/ansible.git
synced 2026-08-05 16:13:06 +02:00
protect against plugins using verify incorrectly
assume false on any errors
This commit is contained in:
@@ -257,8 +257,13 @@ class InventoryManager(object):
|
|||||||
plugin_name = to_native(getattr(plugin, '_load_name', getattr(plugin, '_original_path', '')))
|
plugin_name = to_native(getattr(plugin, '_load_name', getattr(plugin, '_original_path', '')))
|
||||||
display.debug(u'Attempting to use plugin %s (%s)' % (plugin_name, plugin._original_path))
|
display.debug(u'Attempting to use plugin %s (%s)' % (plugin_name, plugin._original_path))
|
||||||
|
|
||||||
# initialize
|
# initialize and figure out if plugin wants to attempt parsing this file
|
||||||
if plugin.verify_file(source):
|
try:
|
||||||
|
plugin_wants = bool(plugin.verify_file(source))
|
||||||
|
except Exception:
|
||||||
|
plugin_wants = False
|
||||||
|
|
||||||
|
if plugin_wants:
|
||||||
try:
|
try:
|
||||||
# in case plugin fails 1/2 way we dont want partial inventory
|
# in case plugin fails 1/2 way we dont want partial inventory
|
||||||
plugin.parse(self._inventory, self._loader, source, cache=cache)
|
plugin.parse(self._inventory, self._loader, source, cache=cache)
|
||||||
|
|||||||
Reference in New Issue
Block a user