From 69740b86e8b8ce7e0407bbe6f8eb9d97dd93022c Mon Sep 17 00:00:00 2001 From: Serge van Ginderachter Date: Tue, 9 Sep 2014 11:37:54 +0200 Subject: [PATCH] Allow InventoryScript JSON with childgroups only and without hosts and vars Without this patch, the simplified syntax is triggered when a group is defined like this: "platforms": { "children": [ "cloudstack" ] } Which results in a group 'platforms' with 1 host 'platforms'. modified: lib/ansible/inventory/script.py --- lib/ansible/inventory/script.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/inventory/script.py b/lib/ansible/inventory/script.py index e43cf24972..87e219e5ec 100644 --- a/lib/ansible/inventory/script.py +++ b/lib/ansible/inventory/script.py @@ -85,7 +85,7 @@ class InventoryScript(object): if not isinstance(data, dict): data = {'hosts': data} # is not those subkeys, then simplified syntax, host with vars - elif not any(k in data for k in ('hosts','vars')): + elif not any(k in data for k in ('hosts','vars','children')): data = {'hosts': [group_name], 'vars': data} if 'hosts' in data: