Fix issue: ERR healthd: Get unit status determine-reboot-cause-'LoadState' (#13697)
- Why I did it Fix issue: ERR healthd: Get unit status determine-reboot-cause-'LoadState'. The error log is only seen on shutdown flow such as fast-reboot/warm-reboot. In shutdown flow, 'LoadState' might not be available in systemctl status output, using [] might cause a KeyError. - How I did it Use dict.get instead of [] - How to verify it Manual test
This commit is contained in:
parent
e3ff08833e
commit
5e6e2c827d
@ -273,7 +273,7 @@ class Sysmonitor(ProcessTaskBase):
|
||||
|
||||
sysctl_show = self.run_systemctl_show(event)
|
||||
|
||||
load_state = sysctl_show['LoadState']
|
||||
load_state = sysctl_show.get('LoadState')
|
||||
if load_state == "loaded":
|
||||
status = sysctl_show['UnitFileState']
|
||||
fail_reason = sysctl_show['Result']
|
||||
|
Reference in New Issue
Block a user