Compare commits

...
Author SHA1 Message Date
wanghe-fit2cloud 680125d5b7 fix(disk): keep disk info when df exits with errors
df still prints valid filesystems when a mount point cannot be queried (for example a stale FUSE mount), but exits non-zero. The dashboard and the disk alert discarded the whole output in that case, so no disk was displayed. Keep using the output whenever it is not empty. Refs #13864.
2026-09-20 15:16:15 +08:00
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -382,7 +382,7 @@ func executeDiskCommand() (string, error) {
cmdMgr2 := cmd.NewCommandMgr(cmd.WithTimeout(1 * time.Second)) cmdMgr2 := cmd.NewCommandMgr(cmd.WithTimeout(1 * time.Second))
stdout, err = cmdMgr2.RunWithStdout("df", "-lhT", "-P") stdout, err = cmdMgr2.RunWithStdout("df", "-lhT", "-P")
} }
if err != nil { if err != nil && strings.TrimSpace(stdout) == "" {
return stdout, err return stdout, err
} }
var lines []string var lines []string
+1 -1
View File
@@ -469,7 +469,7 @@ func loadDiskInfo() []dto.DiskInfo {
cmd.PipeCommand{Name: "df", Args: []string{"-lhT", "-P"}}, cmd.PipeCommand{Name: "df", Args: []string{"-lhT", "-P"}},
cmd.PipeCommand{Name: "awk", Args: []string{format}}, cmd.PipeCommand{Name: "awk", Args: []string{format}},
) )
if err != nil { if err != nil && strings.TrimSpace(stdout) == "" {
return datas return datas
} }
} }