mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-04-15 07:16:34 +00:00
fix custom redactors file selectors in support bundle subdirectory (#336)
* fix custom redactors file selectors in support bundle subdirectory
This commit is contained in:
committed by
GitHub
parent
c1f9b3906d
commit
afa0bc56d4
@@ -449,7 +449,6 @@ func runCollectors(v *viper.Viper, collectors []*troubleshootv1beta2.Collect, ad
|
||||
Collect: desiredCollector,
|
||||
ClientConfig: config,
|
||||
Namespace: v.GetString("namespace"),
|
||||
PathPrefix: filepath.Base(bundlePath),
|
||||
}
|
||||
cleanedCollectors = append(cleanedCollectors, &collector)
|
||||
}
|
||||
@@ -500,8 +499,7 @@ func runCollectors(v *viper.Viper, collectors []*troubleshootv1beta2.Collect, ad
|
||||
}
|
||||
|
||||
if result != nil {
|
||||
// results already contain the bundle dir name in their paths
|
||||
err = saveCollectorOutput(result, filepath.Dir(bundlePath), collector)
|
||||
err = saveCollectorOutput(result, bundlePath, collector)
|
||||
if err != nil {
|
||||
progressChan <- fmt.Errorf("failed to parse collector spec %q: %v", collector.GetDisplayName(), err)
|
||||
continue
|
||||
|
||||
@@ -2,7 +2,6 @@ package collect
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
@@ -20,7 +19,6 @@ type Collector struct {
|
||||
RBACErrors []error
|
||||
ClientConfig *rest.Config
|
||||
Namespace string
|
||||
PathPrefix string
|
||||
}
|
||||
|
||||
type Collectors []*Collector
|
||||
@@ -209,15 +207,6 @@ func (c *Collector) RunCollectorSync(globalRedactors []*troubleshootv1beta2.Reda
|
||||
return
|
||||
}
|
||||
|
||||
if c.PathPrefix != "" {
|
||||
// prefix file paths
|
||||
prefixed := map[string][]byte{}
|
||||
for k, v := range result {
|
||||
prefixed[filepath.Join(c.PathPrefix, k)] = v
|
||||
}
|
||||
result = prefixed
|
||||
}
|
||||
|
||||
if c.Redact {
|
||||
result, err = redactMap(result, globalRedactors)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user