fix custom redactors file selectors in support bundle subdirectory (#336)

* fix custom redactors file selectors in support bundle subdirectory
This commit is contained in:
Salah Aldeen Al Saleh
2021-03-11 08:45:20 -08:00
committed by GitHub
parent c1f9b3906d
commit afa0bc56d4
2 changed files with 1 additions and 14 deletions

View File

@@ -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

View File

@@ -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)
}