]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.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)
committerJohn Mulligan <jmulligan@redhat.com>
Thu, 30 Mar 2023 20:52:53 +0000 (16:52 -0400)
commit8042e3cefb864ffd272501c73b5909fc10c9400f
tree81a8b9f87bdfbbefe40d72b4a64178d946dfd1cd
parente767b8643aa6565a6149a600df3d87a7b31f737a
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>
src/pybind/mgr/dashboard/services/access_control.py
src/pybind/mgr/dashboard/services/sso.py