With two identical inventory queries, one with the AllEnvs flag and one without both queries return the data from the query with the AllEnvs flag set.
Inventory queries use a pre calculated list of nodes to loop over to determine which nodes match the inventory query. If any inventory queries have the AllEnvs flag set then nodes from all environments will be present in the pre calculated list of nodes. Thus other queries which do not have the AllEnvs flags set could then match nodes from other environments.
The 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. Unit tests are also added to check this functionality.
With two identical inventory queries, one with the AllEnvs flag and one without both queries return the data from the query with the AllEnvs flag set.
Inventory queries use a pre calculated list of nodes to loop over to determine which nodes match the inventory query. If any inventory queries have the AllEnvs flag set then nodes from all environments will be present in the pre calculated list of nodes. Thus other queries which do not have the AllEnvs flags set could then match nodes from other environments.
The 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. Unit tests are also added to check this functionality.