Skip to content

Commit afa0bc5

Browse files
author
Salah Aldeen Al Saleh
authored
fix custom redactors file selectors in support bundle subdirectory (#336)
* fix custom redactors file selectors in support bundle subdirectory
1 parent c1f9b39 commit afa0bc5

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

cmd/troubleshoot/cli/run.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,6 @@ func runCollectors(v *viper.Viper, collectors []*troubleshootv1beta2.Collect, ad
449449
Collect: desiredCollector,
450450
ClientConfig: config,
451451
Namespace: v.GetString("namespace"),
452-
PathPrefix: filepath.Base(bundlePath),
453452
}
454453
cleanedCollectors = append(cleanedCollectors, &collector)
455454
}
@@ -500,8 +499,7 @@ func runCollectors(v *viper.Viper, collectors []*troubleshootv1beta2.Collect, ad
500499
}
501500

502501
if result != nil {
503-
// results already contain the bundle dir name in their paths
504-
err = saveCollectorOutput(result, filepath.Dir(bundlePath), collector)
502+
err = saveCollectorOutput(result, bundlePath, collector)
505503
if err != nil {
506504
progressChan <- fmt.Errorf("failed to parse collector spec %q: %v", collector.GetDisplayName(), err)
507505
continue

pkg/collect/collector.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package collect
22

33
import (
44
"context"
5-
"path/filepath"
65
"strconv"
76

87
"github.com/pkg/errors"
@@ -20,7 +19,6 @@ type Collector struct {
2019
RBACErrors []error
2120
ClientConfig *rest.Config
2221
Namespace string
23-
PathPrefix string
2422
}
2523

2624
type Collectors []*Collector
@@ -209,15 +207,6 @@ func (c *Collector) RunCollectorSync(globalRedactors []*troubleshootv1beta2.Reda
209207
return
210208
}
211209

212-
if c.PathPrefix != "" {
213-
// prefix file paths
214-
prefixed := map[string][]byte{}
215-
for k, v := range result {
216-
prefixed[filepath.Join(c.PathPrefix, k)] = v
217-
}
218-
result = prefixed
219-
}
220-
221210
if c.Redact {
222211
result, err = redactMap(result, globalRedactors)
223212
}

0 commit comments

Comments
 (0)