From: John Mulligan Date: Tue, 28 Mar 2023 21:09:30 +0000 (-0400) Subject: mgr/dashboard: ignore type checking on mgr proxy object assignments X-Git-Tag: v17.2.8~507^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d30bb3704cb95932fae87c3329d7c3cdd6a61d7e;p=ceph.git mgr/dashboard: ignore type checking on mgr proxy object assignments 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 (cherry picked from commit 8042e3cefb864ffd272501c73b5909fc10c9400f) --- diff --git a/src/pybind/mgr/dashboard/services/access_control.py b/src/pybind/mgr/dashboard/services/access_control.py index d379d6e21465..212de04b2ab9 100644 --- a/src/pybind/mgr/dashboard/services/access_control.py +++ b/src/pybind/mgr/dashboard/services/access_control.py @@ -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 diff --git a/src/pybind/mgr/dashboard/services/sso.py b/src/pybind/mgr/dashboard/services/sso.py index 74b1a3e52cf5..2290e6ea3e15 100644 --- a/src/pybind/mgr/dashboard/services/sso.py +++ b/src/pybind/mgr/dashboard/services/sso.py @@ -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 = [