api: smart: return unknown health instead of error message
In case of an error, the WebGUI expects the SMART data API endpoint to return a health value, but it will return an error message directly. To make this more user friendly, mask the error in the API handler. Signed-off-by: Daniel Kral <d.kral@proxmox.com> Link: https://lore.proxmox.com/20250415071123.36921-1-d.kral@proxmox.com
This commit is contained in:
committed by
Thomas Lamprecht
parent
7b41368fc3
commit
0d2df3048a
@ -216,7 +216,7 @@ __PACKAGE__->register_method({
|
|||||||
|
|
||||||
my $disk = PVE::Diskmanage::verify_blockdev_path($param->{disk});
|
my $disk = PVE::Diskmanage::verify_blockdev_path($param->{disk});
|
||||||
|
|
||||||
my $result = PVE::Diskmanage::get_smart_data($disk, $param->{healthonly});
|
my $result = eval { PVE::Diskmanage::get_smart_data($disk, $param->{healthonly}) };
|
||||||
|
|
||||||
$result->{health} = 'UNKNOWN' if !defined $result->{health};
|
$result->{health} = 'UNKNOWN' if !defined $result->{health};
|
||||||
$result = { health => $result->{health} } if $param->{healthonly};
|
$result = { health => $result->{health} } if $param->{healthonly};
|
||||||
|
|||||||
Reference in New Issue
Block a user