Support bundles: fix user collector permissions and format collector output (#64531)

* fix user collector permissions and format collector output

* lint
This commit is contained in:
Ieva 2023-03-09 16:43:18 +00:00 committed by GitHub
parent 3336327306
commit ed11c32c1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View File

@ -137,7 +137,7 @@ func (uss *UsageStats) supportBundleCollector() supportbundles.Collector {
return nil, err
}
data, err := json.Marshal(report)
data, err := json.MarshalIndent(report, "", " ")
if err != nil {
return nil, err
}

View File

@ -79,7 +79,7 @@ func (s *Service) bundle(ctx context.Context, collectors []string, uid string) (
}
item, err := collector.Fn(ctx)
if err != nil {
s.log.Warn("Failed to collect support bundle item", "error", err)
s.log.Warn("Failed to collect support bundle item", "error", err, "collector", collector.UID)
}
// write item to file

View File

@ -419,7 +419,9 @@ func (s *Service) supportBundleCollector() supportbundles.Collector {
Login: "sa-supportbundle",
OrgRole: "Admin",
IsGrafanaAdmin: true,
IsServiceAccount: true},
IsServiceAccount: true,
Permissions: map[int64]map[string][]string{ac.GlobalOrgID: {ac.ActionUsersRead: {ac.ScopeGlobalUsersAll}}},
},
OrgID: 0,
Query: "",
Page: 0,
@ -433,7 +435,7 @@ func (s *Service) supportBundleCollector() supportbundles.Collector {
return nil, err
}
userBytes, err := json.Marshal(res.Users)
userBytes, err := json.MarshalIndent(res.Users, "", " ")
if err != nil {
return nil, err
}