#207 avoid trying to bring up wrong inventory when processing dynamic inventory
Merged by astepano. Opened by bgoncalv.
bgoncalv/standard-test-roles fix-check-subjects  into  master

Download 207.patch

Fix messages like:
Launching virtual machine for a33bc36b3d2133714cffba130a08db0433f71249029fe148cbe0056230f32d46

# ANSIBLE_INVENTORY=$(test -e inventory && echo inventory || echo /usr/share/ansible/inventory) TEST_SUBJECTS=docker:docker.io/fedora:rawhide ansible-inventory --list
Launching Docker container for docker.io/fedora:rawhide
Redirecting to /bin/systemctl start docker.service
a33bc36b3d2133714cffba130a08db0433f71249029fe148cbe0056230f32d46
[ERROR]:
Launching virtual machine for a33bc36b3d2133714cffba130a08db0433f71249029fe148cbe0056230f32d46
standard-inventory-qcow2: qemu failed to launch qcow2 image: a33bc36b3d2133714cffba130a08db0433f71249029fe148cbe0056230f32d46
{
    "_meta": {
        "hostvars": {
            "a33bc36b3d2133714cffba130a08db0433f71249029fe148cbe0056230f32d46": {
                "ansible_connection": "docker", 
                "ansible_python_interpreter": "/usr/bin/python3"
            }
        }
    }, 
    "all": {
        "children": [
            "localhost", 
            "subjects", 
            "ungrouped"
        ]
    }, 
    "localhost": {
        "hosts": [
            "a33bc36b3d2133714cffba130a08db0433f71249029fe148cbe0056230f32d46"
        ]
    }, 
    "subjects": {
        "hosts": [
            "a33bc36b3d2133714cffba130a08db0433f71249029fe148cbe0056230f32d46"
        ]
    }, 
    "ungrouped": {}
}
# ANSIBLE_INVENTORY=$(test -e inventory && echo inventory || echo /usr/share/ansible/inventory) TEST_SUBJECTS=local ansible-inventory --list
[ERROR]:
Launching virtual machine for local
standard-inventory-qcow2: qemu failed to launch qcow2 image: local
{
    "_meta": {
        "hostvars": {
            "local": {
                "ansible_connection": "local"
            }
        }
    }, 
    "all": {
        "children": [
            "localhost", 
            "subjects", 
            "ungrouped"
        ]
    }, 
    "localhost": {
        "hosts": [
            "local"
        ]
    }, 
    "subjects": {
        "hosts": [
            "local"
        ]
    }, 
    "ungrouped": {}
}

rebased onto 183e5c0715a8c1dcd524a9d4c263bddd2820e25f

Changes are about moving chk code to more common place.
Seems good, thank you.

@bgoncalv standard-inventory-local doesn't have this issue, right?

@astepano no, it already handles it:

if host == "local":
    return {"ansible_connection": "local"}
return EMPTY_INVENTORY

Commit 8bc781bf fixes this pull-request

Pull-Request has been merged by astepano

Pull-Request has been merged by astepano

Metadata