]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
pybind/mgr/rook: use AllMatcher when size is not provided
authorJohn Mulligan <jmulligan@redhat.com>
Sat, 20 Jan 2024 16:22:51 +0000 (11:22 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 24 Jan 2024 18:33:29 +0000 (13:33 -0500)
commit90f9a98c8cdbff957414ee7952b4632a2d387bb8
treeab60eaec499edf0e65bfe197368acba7e1eb357b
parent86f23452752032f6768d312e2d772dca8b3c6beb
pybind/mgr/rook: use AllMatcher when size is not provided

Issue found by mypy 1.6.1. The previous code was:
`and ((sizematcher != None) or sizematcher.compare(device)`
meaning that if sizematcher is not none "return" true, but if
sizematcher is not none execute the compare method. This is of course
impossible as None will never have a compare method. I assume that the

At Kefu Chai's suggestion we can replace the None condition with an
AllMatcher object when no size is provided to create a size matcher.
This both corrects the error and makes the code much simpler and more
readable.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/rook/rook_cluster.py