summaryrefslogtreecommitdiff
path: root/lib/ansible/inventory
diff options
context:
space:
mode:
authorBrian Coca <bcoca@users.noreply.github.com>2018-11-07 11:09:32 -0500
committerGitHub <noreply@github.com>2018-11-07 11:09:32 -0500
commit903cfa63cbf51ba8af23862886dce79230f9c1cb (patch)
treee2a5f42a53ffe4ab0fc39d8e40383294e4a52f46 /lib/ansible/inventory
parent4961f003e577d57c67a6fd0bd9904a7b5f3a1fbf (diff)
downloadansible-903cfa63cbf51ba8af23862886dce79230f9c1cb.tar.gz
make inventory warnings a bit smarter (#46284)
less annoying for common cases add comment for 'tricky' conditional
Diffstat (limited to 'lib/ansible/inventory')
-rw-r--r--lib/ansible/inventory/manager.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/ansible/inventory/manager.py b/lib/ansible/inventory/manager.py
index fc39e25db2..6e174a04f7 100644
--- a/lib/ansible/inventory/manager.py
+++ b/lib/ansible/inventory/manager.py
@@ -289,7 +289,9 @@ class InventoryManager(object):
if C.INVENTORY_ANY_UNPARSED_IS_FAILED:
raise AnsibleError(u'Completely failed to parse inventory source %s' % (source))
if not parsed:
- display.warning("Unable to parse %s as an inventory source" % source)
+ if source != '/etc/ansible/hosts' or os.path.exists(source):
+ # only warn if NOT using the default and if using it, only if the file is present
+ display.warning("Unable to parse %s as an inventory source" % source)
# clear up, jic
self._inventory.current_source = None