]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mgr/dashboard: fix KeyError exception in HardwareService.get_summary() 63721/head
authorGuillaume Abrioux <gabrioux@ibm.com>
Wed, 4 Jun 2025 14:23:43 +0000 (16:23 +0200)
committerGuillaume Abrioux <gabrioux@ibm.com>
Wed, 4 Jun 2025 19:16:02 +0000 (21:16 +0200)
commit1b9bb174bf9a86242d1f0933a8aef6a61d1ac992
treef354a2959e7cd12b0d8ea4a48f9a8ad33489ea1a
parent03238f02e19dadc4a65ef66ec3fffb6cb21d3403
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>
src/pybind/mgr/dashboard/services/hardware.py