mirror of
https://github.com/minio/minio.git
synced 2024-12-25 06:35:56 -05:00
fix: osinfos incomplete in case of warnings (#11505)
The function used for getting host information (host.SensorsTemperaturesWithContext) returns warnings in some cases. Returning with error in such cases means we miss out on the other useful information already fetched (os info). If the OS info has been succesfully fetched, it should always be included in the output irrespective of whether the other data (CPU sensors, users) could be fetched or not.
This commit is contained in:
parent
93fd248b52
commit
928de04f7a
@ -37,7 +37,10 @@ func getLocalOsInfo(ctx context.Context, r *http.Request) madmin.ServerOsInfo {
|
||||
addr = GetLocalPeer(globalEndpoints)
|
||||
}
|
||||
|
||||
info, err := host.InfoWithContext(ctx)
|
||||
srvrOsInfo := madmin.ServerOsInfo{Addr: addr}
|
||||
var err error
|
||||
|
||||
srvrOsInfo.Info, err = host.InfoWithContext(ctx)
|
||||
if err != nil {
|
||||
return madmin.ServerOsInfo{
|
||||
Addr: addr,
|
||||
@ -45,23 +48,18 @@ func getLocalOsInfo(ctx context.Context, r *http.Request) madmin.ServerOsInfo {
|
||||
}
|
||||
}
|
||||
|
||||
sensors, err := host.SensorsTemperaturesWithContext(ctx)
|
||||
srvrOsInfo.Sensors, err = host.SensorsTemperaturesWithContext(ctx)
|
||||
if err != nil {
|
||||
return madmin.ServerOsInfo{
|
||||
Addr: addr,
|
||||
Error: fmt.Sprintf("sensors-temp: %v", err),
|
||||
// Set error only when it's not of WARNINGS type
|
||||
if _, isWarning := err.(*host.Warnings); !isWarning {
|
||||
srvrOsInfo.Error = fmt.Sprintf("sensors-temp: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// ignore user err, as it cannot be obtained reliably inside containers
|
||||
users, _ := host.UsersWithContext(ctx)
|
||||
srvrOsInfo.Users, _ = host.UsersWithContext(ctx)
|
||||
|
||||
return madmin.ServerOsInfo{
|
||||
Addr: addr,
|
||||
Info: info,
|
||||
Sensors: sensors,
|
||||
Users: users,
|
||||
}
|
||||
return srvrOsInfo
|
||||
}
|
||||
|
||||
func getLocalDiskHwInfo(ctx context.Context, r *http.Request) madmin.ServerDiskHwInfo {
|
||||
|
Loading…
Reference in New Issue
Block a user