mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-04-15 07:16:34 +00:00
Fix missing longhorn logs
This commit is contained in:
@@ -133,8 +133,8 @@ func cephCommandExec(ctx context.Context, c *Collector, cephCollector *troublesh
|
||||
return errors.Wrap(err, "failed to exec command")
|
||||
}
|
||||
|
||||
pathPrefix := GetCephCollectorFilepath(cephCollector.CollectorName, cephCollector.Namespace)
|
||||
for srcFilename, _ := range results {
|
||||
pathPrefix := GetCephCollectorFilepath(cephCollector.CollectorName, cephCollector.Namespace)
|
||||
var dstFileName string
|
||||
switch {
|
||||
case strings.HasSuffix(srcFilename, "-stdout.txt"):
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"sync"
|
||||
@@ -205,9 +206,12 @@ func Longhorn(c *Collector, longhornCollector *troubleshootv1beta2.Longhorn) (Co
|
||||
return nil, errors.Wrap(err, "collect longhorn logs")
|
||||
}
|
||||
logsDir := GetLonghornLogsDirectory(ns)
|
||||
for key, log := range logs {
|
||||
key = filepath.Join(logsDir, key)
|
||||
output.SaveResult(c.BundlePath, key, bytes.NewBuffer(log))
|
||||
for srcFilename, _ := range logs {
|
||||
dstFileName := path.Join(logsDir, srcFilename)
|
||||
err := copyResult(logs, output, c.BundlePath, srcFilename, dstFileName)
|
||||
if err != nil {
|
||||
logger.Printf("Failed to copy file %s; %v", srcFilename, err)
|
||||
}
|
||||
}
|
||||
|
||||
// https://longhorn.io/docs/1.1.1/advanced-resources/data-recovery/corrupted-replica/
|
||||
|
||||
@@ -95,7 +95,7 @@ func (r CollectorResult) GetReader(bundlePath string, relativePath string) (io.R
|
||||
}
|
||||
|
||||
filename := filepath.Join(bundlePath, relativePath)
|
||||
f, err := os.Open(filename)
|
||||
f, err := os.Open(filename) // does this ever close?
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to open file")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user