Fix indentical inventory queries with different flags returning incorrect data

With two indentical inventory queries, one with the AllEnvs flag and
one without both queries return the data from the query with the AllEnvs
flag set.

This fix adds a test to the invitem class when assembling the inventory
query result to check that the node environments match or that the
query has the AllEnvs flag set.
5 files changed