You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when we chain queries using: then("query", keep_previous_results=True)
if the two query link_prop mappings return different values there's no way to link the two queries together.
Right now this fails noisily but if it's a common occurance - we may want to return "Not Found" instead
Change query_output._parse_forwarded_outputs to this:
def _parse_forwarded_outputs(
self, openstack_resource: OpenstackResourceObj
) -> Dict[str, str]:
"""
Generates a dictionary of forwarded outputs for the item given
:param openstack_resource: openstack resource item to parse forwarded outputs for
"""
forwarded_output_dict = {}
for grouped_property, outputs in self.forwarded_outputs.items():
prop_val = self._parse_property(grouped_property, openstack_resource)
# this "should not" error because forwarded outputs should always be a super-set
# but sometimes resolving the property fails for whatever reason
# in this case just copy all the keys in one of the dictionaries in the list
# since they should be equal and set the values to "Not Found"
try:
output_list = outputs[prop_val]
# should only ever contain one element since it's grouped by a unique id
forwarded_output_dict.update(output_list[0])
except KeyError as exp:
first_output_entry = list(outputs.values())[0][0]
forwarded_output_dict.update(
{key: "Not Found" for key in list(first_output_entry.keys())}
)
return forwarded_output_dict
and equivalent test
def test_parse_forwarded_prop_value_not_found(instance):
"""
Tests parse_forwarded_prop() method
where a prop_value is not found, set to "Not Found"
"""
forwarded_entry = {"forwarded-prop1": "val1", "forwarded-prop2": "val2"}
instance.update_forwarded_outputs("prop1", {"prop-val1": [forwarded_entry]})
with patch(
"openstack_query.query_blocks.query_output.QueryOutput._parse_property"
) as mock_parse_property:
mock_parse_property.return_value = "invalid-prop"
# pylint:disable=protected-access
res = instance._parse_forwarded_outputs("obj1")
mock_parse_property.assert_called_once_with("prop1", "obj1")
assert res == {key: "Not Found" for key in forwarded_entry}
The text was updated successfully, but these errors were encountered:
when we chain queries using:
then("query", keep_previous_results=True)
if the two query link_prop mappings return different values there's no way to link the two queries together.
Right now this fails noisily but if it's a common occurance - we may want to return "Not Found" instead
Change query_output._parse_forwarded_outputs to this:
and equivalent test
The text was updated successfully, but these errors were encountered: