protect against plugins using verify incorrectly

assume false on any errors

(cherry picked from commit ef40e5e3b2)
This commit is contained in:
Brian Coca 2018-02-22 11:53:40 -05:00 committed by Toshio Kuratomi
parent 92cea82a4e
commit 18359b0cec

View file

@ -254,8 +254,13 @@ class InventoryManager(object):
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))
# initialize
if plugin.verify_file(source):
# initialize and figure out if plugin wants to attempt parsing this file
try:
plugin_wants = bool(plugin.verify_file(source))
except Exception:
plugin_wants = False
if plugin_wants:
try:
plugin.parse(self._inventory, self._loader, source, cache=cache)
parsed = True