Skip to content

feat: add support for telemetry-required licenses #6194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! feat: support licenses that require telemetry
  • Loading branch information
ammario committed Feb 13, 2023
commit 81bca12aace229a9f740209c7ec785fb7e15c15d
9 changes: 7 additions & 2 deletions enterprise/coderd/coderd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"crypto/ed25519"
"crypto/tls"
"crypto/x509"
"fmt"
"net/http"
"sync"
"time"
Expand Down Expand Up @@ -255,7 +254,13 @@ func (api *API) updateEntitlements(ctx context.Context) error {
}

if entitlements.RequireTelemetry && !api.DeploymentConfig.Telemetry.Enable.Value {
return xerrors.New("telemetry disabled, but a license requires telemetry")
// We can't fail because then the user couldn't remove the offending
// license w/o a restart.
entitlements.Errors = append(
entitlements.Errors, "License requires telemetry but telemetry is disabled",
)
api.Logger.Error(ctx, "license requires telemetry enabled")
return nil
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kylecarbs — is it safe to return early here to your knowledge?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you return early it doesn't seem like any of the enterprise features would work, if that's your goal. I think it'd probably be better to just append to the entitlements created above instead of overwriting and let the rest of the function run.

entitlements.Experimental = api.DeploymentConfig.Experimental.Value || len(api.AGPL.Experiments) != 0
Expand Down