]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
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)
commitf268fa96727aaf045ea6ede5d1e10f6dc226764a
treeffdbbe24bcbb781882f0cf5b404dd68cfaf57665
parent4f59e3b9271cf7a0fa019a9f36a81cbb7bd6a338
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 <jmulligan@redhat.com>
(cherry picked from commit 8042e3cefb864ffd272501c73b5909fc10c9400f)
src/pybind/mgr/dashboard/services/access_control.py
src/pybind/mgr/dashboard/services/sso.py