#193 Fix inventory scripts, to produce output only if related TEST_SUBJECTS is specified.
Opened by astepano. Modified

Inventory scripts should not add localhost if TEST_SUBJECTS is unrelated:

> touch empty
/home/fedora/tmp [fedora@f26-box] [12:53]
> ansible-inventory --list -i empty                                                 
 [WARNING]: Could not match supplied host pattern, ignoring: all
{
    "_meta": {
        "hostvars": {}
    }, 
    "all": {
        "children": [
            "ungrouped"
        ]
    }, 
    "ungrouped": {}
}

If TEST_SUBJECTS is not set do not produce output or at least same output as for empty

> ansible-inventory --list -i /usr/share/ansible/inventory/standard-inventory-docker
 [WARNING]: Could not match supplied host pattern, ignoring: all
{
    "_meta": {
        "hostvars": {}
    }, 
    "all": {
        "children": [
            "localhost",   <--wrong
            "subjects", 
            "ungrouped"
        ]
    }, 
    "localhost": {},   <--wrong
    "subjects": {}, 
    "ungrouped": {}
}

https://pagure.io/standard-test-roles/pull-request/194

Metadata