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
This commit is contained in:
Serge van Ginderachter 2014-09-09 11:37:54 +02:00
parent dc1f233e8d
commit 69740b86e8

View file

@ -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: