Fix node partial name matching in Haskell code
This implements QffHostname and fixes the node listing (as well as export listing when filtering on node name). This bug was hidden by the fact that node listing with "gnt-node list aa" works if you don't have live queries (as it was originally), as the choosing of wanted nodes out of the config based on short names works. What didn't work was later post-filtering based on such short names (kind of duplicate, but that's how the code path is). By implementing QffHostname, we can have custom equality checks, like in the Python code. What I don't like is how convoluted the testing on various left/right combinations is, but I didn't find an easier way. The included unittest tests the partial filtering behaviour, and fails if the node name flag is not set to QffHostname. Signed-off-by:Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
Showing
- src/Ganeti/Query/Export.hs 1 addition, 1 deletionsrc/Ganeti/Query/Export.hs
- src/Ganeti/Query/Filter.hs 35 additions, 11 deletionssrc/Ganeti/Query/Filter.hs
- src/Ganeti/Query/Node.hs 1 addition, 1 deletionsrc/Ganeti/Query/Node.hs
- src/Ganeti/Query/Types.hs 2 additions, 1 deletionsrc/Ganeti/Query/Types.hs
- test/hs/Test/Ganeti/Query/Query.hs 34 additions, 1 deletiontest/hs/Test/Ganeti/Query/Query.hs
Loading
Please register or sign in to comment