mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Always create 'all' group
Create 'all' even if host_list is empty, as this group needs to exist when creating the implicit 'localhost' host. Fixes #12391
This commit is contained in:
@@ -86,11 +86,16 @@ class Inventory(object):
|
|||||||
|
|
||||||
self.parser = None
|
self.parser = None
|
||||||
|
|
||||||
|
# Always create the 'all' group, even if host_list is
|
||||||
|
# empty: in this case we will subsequently an the implicit
|
||||||
|
# 'localhost' to it.
|
||||||
|
|
||||||
|
all = Group('all')
|
||||||
|
self.groups = [ all ]
|
||||||
|
|
||||||
if host_list is None:
|
if host_list is None:
|
||||||
pass
|
pass
|
||||||
elif isinstance(host_list, list):
|
elif isinstance(host_list, list):
|
||||||
all = Group('all')
|
|
||||||
self.groups = [ all ]
|
|
||||||
for h in host_list:
|
for h in host_list:
|
||||||
(host, port) = parse_address(h, allow_ranges=False)
|
(host, port) = parse_address(h, allow_ranges=False)
|
||||||
all.add_host(Host(host, port))
|
all.add_host(Host(host, port))
|
||||||
|
|||||||
Reference in New Issue
Block a user