Closed maugustosilva closed 1 year ago
It looks like right here we need to return the resource data found when we observed the match. It returns the correct URI, but all other info returned (like you already said) is from the last loop iteration.
It is intentional we're not breaking out of the loop on the match immediately; we want to ensure there is exactly one resource that matches, and if multiple resources match, we return an error. So, we'll need to save off the response data when we hit the matching case initially.
Ah, makes perfect sense not exiting immediately indeed! However, we do need the right answer at the end, and saving the response data should do it.
Thanks for the prompt answer.
This was tested with a bunch of VMs with latest
sushy-emulator
. Apologies in advance for the verbose output, but it is relevant on debugging.Here is the "target" VM.
The idea is to get this VM via either
Name
orUUID
.So, from what I can see, in the lines I have marked with
->
, theTransport:getPathBy:Match:
actually successfully matches the correct (Name
) parameter, but then the loop is not interrupted and the last system on the list is returned instead (which is a dangerous error, IMO, as one could end up powering off the wrong system).