]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
mgr/dashboard: fix KeyError exception in HardwareService.get_summary()
authorGuillaume Abrioux <gabrioux@ibm.com>
Wed, 4 Jun 2025 14:23:43 +0000 (16:23 +0200)
committerGuillaume Abrioux <gabrioux@ibm.com>
Fri, 6 Jun 2025 06:30:39 +0000 (06:30 +0000)
commitf80d395c800abd1e73b8eb2f86b337d17412e8e7
tree98cea56512352543ae83a7cf95f112424043b288
parent239dd0ee4e40ca0778a2799c5f30447510642167
mgr/dashboard: fix KeyError exception in HardwareService.get_summary()

Typical error:

```
[dashboard ERROR exception] Internal Server Error
Traceback (most recent call last):
  File "/usr/share/ceph/mgr/dashboard/services/exception.py", line 48, in dashboard_exception_handler
    return handler(*args, **kwargs)
  File "/lib/python3.9/site-packages/cherrypy/_cpdispatch.py", line 54, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/usr/share/ceph/mgr/dashboard/controllers/_base_controller.py", line 263, in inner
    ret = func(*args, **kwargs)
  File "/usr/share/ceph/mgr/dashboard/controllers/_rest_controller.py", line 193, in wrapper
    return func(*vpath, **params)
  File "/usr/share/ceph/mgr/dashboard/controllers/hardware.py", line 21, in summary
    return HardwareService.get_summary(categories, hostname)
  File "/usr/share/ceph/mgr/dashboard/services/hardware.py", line 33, in get_summary
    'ok': sum(item['status']['health'] == 'OK' for items in data.values()
  File "/usr/share/ceph/mgr/dashboard/services/hardware.py", line 33, in <genexpr>
    'ok': sum(item['status']['health'] == 'OK' for items in data.values()
KeyError: 'status'
```

The recent change from commit `fbcdf571ca1` introduced this regression.

Fixes: https://tracker.ceph.com/issues/71558
Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
(cherry picked from commit 1b9bb174bf9a86242d1f0933a8aef6a61d1ac992)
src/pybind/mgr/dashboard/services/hardware.py