mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-05 07:54:00 -07:00
dont warn on not matching 'all' (#32806)
* dont warn on not matching 'all' the implicit localhost warning shoudl be enough * centralized no hosts handling also extended info on implicit only
This commit is contained in:
parent
2f2f118665
commit
87c75b19dd
5 changed files with 26 additions and 32 deletions
|
@ -426,16 +426,7 @@ class ConsoleCLI(CLI, cmd.Cmd):
|
|||
ask_vault_pass=self.options.ask_vault_pass)
|
||||
self.loader.set_vault_secrets(vault_secrets)
|
||||
|
||||
no_hosts = False
|
||||
if len(self.inventory.list_hosts()) == 0:
|
||||
# Empty inventory
|
||||
no_hosts = True
|
||||
display.warning("provided hosts list is empty, only localhost is available")
|
||||
|
||||
self.inventory.subset(self.options.subset)
|
||||
hosts = self.inventory.list_hosts(self.pattern)
|
||||
if len(hosts) == 0 and not no_hosts:
|
||||
raise AnsibleError("Specified hosts and/or --limit does not match any hosts")
|
||||
hosts = CLI.get_host_list(self.inventory, self.options.subset, self.pattern)
|
||||
|
||||
self.groups = self.inventory.list_groups()
|
||||
self.hosts = [x.name for x in hosts]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue