avoid empty groups in json output (#45621)

they get confused as hosts by script plugin

fixes #45601
pull/44146/merge
Brian Coca 6 years ago committed by GitHub
parent e619052424
commit ddb3764039
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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…
Cancel
Save