]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: ignore type checking on mgr proxy object assignments
authorJohn Mulligan <jmulligan@redhat.com>
Tue, 28 Mar 2023 21:09:30 +0000 (17:09 -0400)
committerAfreen <afreen23.git@gmail.com>
Thu, 15 Feb 2024 08:29:01 +0000 (13:59 +0530)
Add `# type: ignore` comments to two dashboard functions that attempt
to set manager properties. There appear to be two approaches to fixing
the problem:

1. The _MgrProxy object that the dashboard uses has a __getattr__ method
for pulling value from the underlying mgr object. It does not have a
__setattr__ method. This means the setting values on _MgrProxy do not
propogate down to the original mgr.
mypy detects the fact that the object doesn't have __setattr__ and
complains. One could add a __setattr__ to the proxy type and mypy
is satisfied.

2. We can just suppress the type check with the comment.

Because I have no idea why the _MgrProxy exists or why it's implemented
the way it is, I feel that 2 is simpler. It is easy enough to go back
later and clean up the comments rather than me investing a lot of time
to understand the dashboard's approach just to bump up the version of
mypy.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 8042e3cefb864ffd272501c73b5909fc10c9400f)

src/pybind/mgr/dashboard/services/access_control.py
src/pybind/mgr/dashboard/services/sso.py

index d379d6e2146557df9dc707afcdec54678326f75f..212de04b2ab960780291342d3eb4b460431238b3 100644 (file)
@@ -569,7 +569,7 @@ class AccessControlDB(object):
 
 
 def load_access_control_db():
-    mgr.ACCESS_CTRL_DB = AccessControlDB.load()
+    mgr.ACCESS_CTRL_DB = AccessControlDB.load()  # type: ignore
 
 
 # CLI dashboard access control scope commands
index 74b1a3e52cf5c59025f6ea909b220d53d24ba506..2290e6ea3e15f71d7d16e74d6a3fbd26438fe997 100644 (file)
@@ -90,7 +90,7 @@ class SsoDB(object):
 
 
 def load_sso_db():
-    mgr.SSO_DB = SsoDB.load()
+    mgr.SSO_DB = SsoDB.load()  # type: ignore
 
 
 SSO_COMMANDS = [