diff options
author | Brian Coca <brian.coca+git@gmail.com> | 2016-05-31 12:15:19 -0400 |
---|---|---|
committer | Brian Coca <brian.coca+git@gmail.com> | 2016-05-31 12:16:06 -0400 |
commit | 4c3c294a030d7b429817f662e48efba92dfd34db (patch) | |
tree | fa020c65f17e6e599622405f1af823fb76878f77 /lib/ansible/cli/adhoc.py | |
parent | 01decf4166ea8fe233b9a728ad4e82a0dbe10cab (diff) | |
download | ansible-4c3c294a030d7b429817f662e48efba92dfd34db.tar.gz |
fixed confusing reporting when no hosts are matched
it was hitting 'empty inventory' warning.
Diffstat (limited to 'lib/ansible/cli/adhoc.py')
-rw-r--r-- | lib/ansible/cli/adhoc.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ansible/cli/adhoc.py b/lib/ansible/cli/adhoc.py index becb43e581..d4f917f2c2 100644 --- a/lib/ansible/cli/adhoc.py +++ b/lib/ansible/cli/adhoc.py @@ -130,7 +130,7 @@ class AdHocCLI(CLI): variable_manager.set_inventory(inventory) no_hosts = False - if len(inventory.list_hosts(pattern)) == 0: + if len(inventory.list_hosts()) == 0: # Empty inventory display.warning("provided hosts list is empty, only localhost is available") no_hosts = True @@ -139,7 +139,7 @@ class AdHocCLI(CLI): hosts = inventory.list_hosts(pattern) if len(hosts) == 0 and no_hosts is False: # Invalid limit - raise AnsibleError("Specified --limit does not match any hosts") + raise AnsibleError("Specified hosts and/or --limit does not match any hosts") if self.options.listhosts: display.display(' hosts (%d):' % len(hosts)) |