]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
pybind/mgr/cephadm: fix typing issue
authorJohn Mulligan <jmulligan@redhat.com>
Sat, 20 Jan 2024 15:45:46 +0000 (10:45 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 23 Jan 2024 14:45:40 +0000 (09:45 -0500)
Found using mypy 0.990.
Newer mypy versions see the check as tautological because `self.func` is
typed as always being `Callable` and thus always true. I don't know if
the typing is wrong or if the if-block is tautological (and redundant).
For now, silence the error by using `getattr` instead of direct
attribute access.

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

index b9dcb18f478a06033edb9464e02e745c5ccabfa3..38cde7806afb5b3d246367f86eb8e7a62cf50ef2 100644 (file)
@@ -150,7 +150,7 @@ class CephadmCheckDefinition:
             "description": self.description,
             "name": self.name,
             "status": self.status,
-            "valid": True if self.func else False
+            "valid": True if getattr(self, 'func', None) else False
         }