only add group if properly defined
also corrected skip message as this has to do with type, not name fixes #40850
This commit is contained in:
parent
ad8e13e9f8
commit
8e4c56d773
1 changed files with 5 additions and 4 deletions
|
@ -112,9 +112,10 @@ class InventoryModule(BaseFileInventoryPlugin):
|
|||
|
||||
def _parse_group(self, group, group_data):
|
||||
|
||||
if isinstance(group_data, MutableMapping):
|
||||
|
||||
self.inventory.add_group(group)
|
||||
|
||||
if isinstance(group_data, MutableMapping):
|
||||
# make sure they are dicts
|
||||
for section in ['vars', 'children', 'hosts']:
|
||||
if section in group_data:
|
||||
|
@ -144,7 +145,7 @@ class InventoryModule(BaseFileInventoryPlugin):
|
|||
self.display.warning('Skipping unexpected key (%s) in group (%s), only "vars", "children" and "hosts" are valid' % (key, group))
|
||||
|
||||
else:
|
||||
self.display.warning("Skipping '%s' as this is not a valid group name" % group)
|
||||
self.display.warning("Skipping '%s' as this is not a valid group definition" % group)
|
||||
|
||||
def _parse_host(self, host_pattern):
|
||||
'''
|
||||
|
@ -164,7 +165,7 @@ class InventoryModule(BaseFileInventoryPlugin):
|
|||
|
||||
try:
|
||||
(pattern, port) = parse_address(hostpattern, allow_ranges=True)
|
||||
except:
|
||||
except Exception:
|
||||
# not a recognizable host pattern
|
||||
pattern = hostpattern
|
||||
port = None
|
||||
|
|
Loading…
Reference in a new issue