mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-04-15 07:16:34 +00:00
Only accept one clusterResources collector
Signed-off-by: Dan Jones <danj@replicated.com>
This commit is contained in:
@@ -21,11 +21,12 @@ func (s *SupportBundle) ConcatSpec(bundle *SupportBundle) {
|
||||
|
||||
func (s *SupportBundleSpec) MergeCollectors(spec *SupportBundleSpec) {
|
||||
for _,c := range spec.Collectors {
|
||||
// we want to move away from checking for specific collectors in favor of allowing collectors to expose their own merge method
|
||||
// ideally we'd just want to be able to call something like c.Merge(spec) here and have the collector's own merge method work out what to do'
|
||||
|
||||
if c.ClusterInfo != nil {
|
||||
// we only actually want one of these so skip if there's already one
|
||||
y := 0
|
||||
// we want to move away from checking for specific collectors in favor of allowing collectors to expose their own merge method
|
||||
for _,v := range s.Collectors{
|
||||
if v.ClusterInfo != nil {
|
||||
y = 1
|
||||
@@ -37,6 +38,19 @@ func (s *SupportBundleSpec) MergeCollectors(spec *SupportBundleSpec) {
|
||||
continue
|
||||
}
|
||||
|
||||
if c.ClusterResources != nil {
|
||||
y := 0
|
||||
for _,v := range s.Collectors {
|
||||
if v.ClusterResources != nil {
|
||||
y = 1
|
||||
}
|
||||
}
|
||||
if y != 1 {
|
||||
s.Collectors = append(s.Collectors, c)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
s.Collectors = append(s.Collectors, c)
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user