mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
avoid empty groups in json output (#45621)
they get confused as hosts by script plugin fixes #45601
This commit is contained in:
parent
e619052424
commit
ddb3764039
2 changed files with 4 additions and 0 deletions
2
changelogs/fragments/no_empty_groups.yml
Normal file
2
changelogs/fragments/no_empty_groups.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- avoid empty groups in ansbile-inventory JSON output as they will be interpreted as hosts
|
|
@ -329,6 +329,8 @@ class InventoryCLI(CLI):
|
||||||
results[group.name]['vars'] = self._get_group_variables(group)
|
results[group.name]['vars'] = self._get_group_variables(group)
|
||||||
|
|
||||||
self._remove_empty(results[group.name])
|
self._remove_empty(results[group.name])
|
||||||
|
if not results[group.name]:
|
||||||
|
del results[group.name]
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue