mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
feat(cli): include license status in support bundle (#18472)
Closes #18207 This PR adds license status to support bundle to help with troubleshooting license-related issues. - `license-status.txt`, is added to the support bundle. - it contains the same output as the `coder license list` command. - license output formatter logic has been extracted into a separate function. - this allows it to be reused both in the `coder license list` cmd and in the support bundle generation.
This commit is contained in:
@ -43,6 +43,7 @@ type Deployment struct {
|
||||
Config *codersdk.DeploymentConfig `json:"config"`
|
||||
Experiments codersdk.Experiments `json:"experiments"`
|
||||
HealthReport *healthsdk.HealthcheckReport `json:"health_report"`
|
||||
Licenses []codersdk.License `json:"licenses"`
|
||||
}
|
||||
|
||||
type Network struct {
|
||||
@ -138,6 +139,21 @@ func DeploymentInfo(ctx context.Context, client *codersdk.Client, log slog.Logge
|
||||
return nil
|
||||
})
|
||||
|
||||
eg.Go(func() error {
|
||||
licenses, err := client.Licenses(ctx)
|
||||
if err != nil {
|
||||
// Ignore 404 because AGPL doesn't have this endpoint
|
||||
if cerr, ok := codersdk.AsError(err); ok && cerr.StatusCode() != http.StatusNotFound {
|
||||
return xerrors.Errorf("fetch license status: %w", err)
|
||||
}
|
||||
}
|
||||
if licenses == nil {
|
||||
licenses = make([]codersdk.License, 0)
|
||||
}
|
||||
d.Licenses = licenses
|
||||
return nil
|
||||
})
|
||||
|
||||
if err := eg.Wait(); err != nil {
|
||||
log.Error(ctx, "fetch deployment information", slog.Error(err))
|
||||
}
|
||||
|
Reference in New Issue
Block a user