Skip to content

Commit 1841c41

Browse files
committed
python-common: fix mypy failure in NVMEoF service spec
Locally, mypy was complaining ``` ceph/deployment/service_spec.py: note: In member "validate" of class "NvmeofServiceSpec": ceph/deployment/service_spec.py:1497: error: Unsupported operand types for > ("float" and "None") [operator] ceph/deployment/service_spec.py:1497: note: Left operand is of type "Optional[float]" ceph/deployment/service_spec.py:1500: error: Unsupported operand types for > ("int" and "None") [operator] ceph/deployment/service_spec.py:1500: note: Left operand is of type "Optional[int]" ``` I'm unsure why those errors didn't show up in the CI, but they make sense to me, so why not fix them. Signed-off-by: Adam King <adking@redhat.com>
1 parent 0089536 commit 1841c41

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/python-common/ceph/deployment/service_spec.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,10 +1494,16 @@ def validate(self) -> None:
14941494
raise SpecValidationError(
14951495
'Invalid SPDK log level. Valid values are: DEBUG, INFO, WARNING, ERROR, NOTICE')
14961496

1497-
if self.spdk_ping_interval_in_seconds < 1.0:
1497+
if (
1498+
self.spdk_ping_interval_in_seconds
1499+
and self.spdk_ping_interval_in_seconds < 1.0
1500+
):
14981501
raise SpecValidationError("SPDK ping interval should be at least 1 second")
14991502

1500-
if self.allowed_consecutive_spdk_ping_failures < 1:
1503+
if (
1504+
self.allowed_consecutive_spdk_ping_failures
1505+
and self.allowed_consecutive_spdk_ping_failures < 1
1506+
):
15011507
raise SpecValidationError("Allowed consecutive SPDK ping failures should be at least 1")
15021508

15031509

0 commit comments

Comments
 (0)