]> git.apps.os.sepia.ceph.com Git - ceph-ci.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)
committerAdam King <adking@redhat.com>
Tue, 25 Apr 2023 12:36:55 +0000 (08:36 -0400)
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 789ccf670207314e065517e887e2738dd76e6fbe..0cbe49bb160ad5359dc6fd47c7f7dd244fe850cc 100644 (file)
@@ -559,7 +559,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 = [