mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
better handling of host lists (#17781)
* better handling of host lists fixes #17762 * corrected message * fixed extras space
This commit is contained in:
parent
86ea21a73d
commit
368497fd14
1 changed files with 6 additions and 3 deletions
|
@ -139,9 +139,12 @@ class AdHocCLI(CLI):
|
|||
|
||||
inventory.subset(self.options.subset)
|
||||
hosts = inventory.list_hosts(pattern)
|
||||
if len(hosts) == 0 and no_hosts is False:
|
||||
if len(hosts) == 0:
|
||||
if no_hosts is False and self.options.subset:
|
||||
# Invalid limit
|
||||
raise AnsibleError("Specified hosts and/or --limit does not match any hosts")
|
||||
raise AnsibleError("Specified --limit does not match any hosts")
|
||||
else:
|
||||
display.warning("No hosts matched, nothing to do")
|
||||
|
||||
if self.options.listhosts:
|
||||
display.display(' hosts (%d):' % len(hosts))
|
||||
|
|
Loading…
Reference in a new issue