mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 22:33:25 +00: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:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user