From f268fa96727aaf045ea6ede5d1e10f6dc226764a Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Tue, 28 Mar 2023 17:09:30 -0400 Subject: [PATCH] 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) --- src/pybind/mgr/dashboard/services/access_control.py | 2 +- src/pybind/mgr/dashboard/services/sso.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/dashboard/services/access_control.py b/src/pybind/mgr/dashboard/services/access_control.py index 789ccf67020..0cbe49bb160 100644 --- a/src/pybind/mgr/dashboard/services/access_control.py +++ b/src/pybind/mgr/dashboard/services/access_control.py @@ -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 diff --git a/src/pybind/mgr/dashboard/services/sso.py b/src/pybind/mgr/dashboard/services/sso.py index 74b1a3e52cf..2290e6ea3e1 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 = [ -- 2.39.5