summaryrefslogtreecommitdiff
path: root/lib/ansible/inventory
diff options
context:
space:
mode:
authorBrian Coca <bcoca@users.noreply.github.com>2017-08-28 17:17:19 -0400
committerGitHub <noreply@github.com>2017-08-28 17:17:19 -0400
commitde6ba4daff48e23bb2bee31cd075e0f6f4c8eb56 (patch)
tree67d552a0871f57ae474258cd777adec2d273b567 /lib/ansible/inventory
parent862cde5e82a83f37eb3d98b4e83e530252b1bedc (diff)
downloadansible-de6ba4daff48e23bb2bee31cd075e0f6f4c8eb56.tar.gz
add toggle to controle inventory parse as error (#28729)
* add toggle to controle inventory parse as error also rearranged new inventory options into it's own ini section * updated with inventory features also minor fixes/consolidation on deprecated/removed modules * tweaked settings
Diffstat (limited to 'lib/ansible/inventory')
-rw-r--r--lib/ansible/inventory/manager.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/ansible/inventory/manager.py b/lib/ansible/inventory/manager.py
index 8e94c6ad2c..1591a773f3 100644
--- a/lib/ansible/inventory/manager.py
+++ b/lib/ansible/inventory/manager.py
@@ -267,9 +267,17 @@ class InventoryManager(object):
else:
if not parsed and failures:
# only if no plugin processed files should we show errors.
- for fail in failures:
- display.warning('\n* Failed to parse %s with %s plugin: %s' % (to_native(fail['src']), fail['plugin'], to_native(fail['exc'])))
- display.vvv(fail['exc'].tb)
+ if C.INVENTORY_UNPARSED_IS_FAILED:
+ msg = "Could not parse inventory source %s with availabel plugins:\n" % source
+ for fail in failures:
+ msg += 'Plugin %s failed: %s\n' % (fail['plugin'], to_native(fail['exc']))
+ if display.verbosity >= 3:
+ msg += "%s\n" % fail['exc'].tb
+ raise AnsibleParserError(msg)
+ else:
+ for fail in failures:
+ display.warning('\n* Failed to parse %s with %s plugin: %s' % (to_native(fail['src']), fail['plugin'], to_native(fail['exc'])))
+ display.vvv(fail['exc'].tb)
if not parsed:
display.warning("Unable to parse %s as an inventory source" % to_native(source))