Merge pull request #69 from salt-formulas/andrewp-fix-inv-query-merging

Fix merging inv query results
diff --git a/reclass/datatypes/tests/test_exports.py b/reclass/datatypes/tests/test_exports.py
index a0acce7..16a45cb 100644
--- a/reclass/datatypes/tests/test_exports.py
+++ b/reclass/datatypes/tests/test_exports.py
@@ -120,5 +120,14 @@
         p.interpolate(e)
         self.assertIn(p.as_dict(), [ r1, r2 ])
 
+    def test_merging_inv_queries(self):
+        e = {'node1': {'a': 1}, 'node2': {'a': 1}, 'node3': {'a': 2}}
+        p1 = Parameters({'exp': '$[ if exports:a == 1 ]'}, SETTINGS, '')
+        p2 = Parameters({'exp': '$[ if exports:a == 2 ]'}, SETTINGS, '')
+        r = { 'exp': [ 'node1', 'node2', 'node3' ] }
+        p1.merge(p2)
+        p1.interpolate(e)
+        self.assertEqual(p1.as_dict(), r)
+
 if __name__ == '__main__':
     unittest.main()
diff --git a/reclass/values/invitem.py b/reclass/values/invitem.py
index 3874f39..5461612 100644
--- a/reclass/values/invitem.py
+++ b/reclass/values/invitem.py
@@ -189,6 +189,9 @@
     def get_references(self):
         return self._question.refs
 
+    def assembleRefs(self, context):
+        return
+
     def get_inv_references(self):
         return self.inv_refs
 
diff --git a/reclass/values/valuelist.py b/reclass/values/valuelist.py
index a56395b..86563fa 100644
--- a/reclass/values/valuelist.py
+++ b/reclass/values/valuelist.py
@@ -71,9 +71,9 @@
         self.ignore_failed_render = True
         for value in self._values:
             if value.has_inv_query:
-                self._inv_refs.extend(value.get_inv_references)
+                self._inv_refs.extend(value.get_inv_references())
                 self._has_inv_query = True
-                if vale.ignore_failed_render() is False:
+                if value.ignore_failed_render() is False:
                     self.ignore_failed_render = False
         if self._has_inv_query is False:
             self.ignore_failed_render = False
@@ -88,6 +88,13 @@
             if value.allRefs is False:
                 self.allRefs = False
 
+    @property
+    def needs_all_envs(self):
+        for value in self._values:
+            if value.needs_all_envs:
+                return True
+        return False
+
     def merge(self):
         output = None
         for n, value in enumerate(self._values):