mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(enterprise/coderd): remove useless provisioner daemon id from request (#16723)
`ServeProvisionerDaemonRequest` has had an ID field for quite a while now. This field is only used for telemetry purposes; the actual daemon ID is created upon insertion in the database. There's no reason to set it, and it's confusing to do so. Deprecating the field and removing references to it.
This commit is contained in:
@@ -388,7 +388,6 @@ func newExternalProvisionerDaemon(t testing.TB, client *codersdk.Client, org uui
|
||||
|
||||
daemon := provisionerd.New(func(ctx context.Context) (provisionerdproto.DRPCProvisionerDaemonClient, error) {
|
||||
return client.ServeProvisionerDaemon(ctx, codersdk.ServeProvisionerDaemonRequest{
|
||||
ID: uuid.New(),
|
||||
Name: testutil.GetRandomName(t),
|
||||
Organization: org,
|
||||
Provisioners: []codersdk.ProvisionerType{provisionerType},
|
||||
|
||||
@@ -175,11 +175,6 @@ func (api *API) provisionerDaemonServe(rw http.ResponseWriter, r *http.Request)
|
||||
return
|
||||
}
|
||||
|
||||
id, _ := uuid.Parse(r.URL.Query().Get("id"))
|
||||
if id == uuid.Nil {
|
||||
id = uuid.New()
|
||||
}
|
||||
|
||||
provisionersMap := map[codersdk.ProvisionerType]struct{}{}
|
||||
for _, provisioner := range r.URL.Query()["provisioner"] {
|
||||
switch provisioner {
|
||||
@@ -295,7 +290,7 @@ func (api *API) provisionerDaemonServe(rw http.ResponseWriter, r *http.Request)
|
||||
api.AGPL.WebsocketWaitMutex.Unlock()
|
||||
defer api.AGPL.WebsocketWaitGroup.Done()
|
||||
|
||||
tep := telemetry.ConvertExternalProvisioner(id, tags, provisioners)
|
||||
tep := telemetry.ConvertExternalProvisioner(daemon.ID, tags, provisioners)
|
||||
api.Telemetry.Report(&telemetry.Snapshot{ExternalProvisioners: []telemetry.ExternalProvisioner{tep}})
|
||||
defer func() {
|
||||
tep.ShutdownAt = ptr.Ref(time.Now())
|
||||
|
||||
@@ -50,7 +50,6 @@ func TestProvisionerDaemonServe(t *testing.T) {
|
||||
defer cancel()
|
||||
daemonName := testutil.MustRandString(t, 63)
|
||||
srv, err := templateAdminClient.ServeProvisionerDaemon(ctx, codersdk.ServeProvisionerDaemonRequest{
|
||||
ID: uuid.New(),
|
||||
Name: daemonName,
|
||||
Organization: user.OrganizationID,
|
||||
Provisioners: []codersdk.ProvisionerType{
|
||||
@@ -180,7 +179,6 @@ func TestProvisionerDaemonServe(t *testing.T) {
|
||||
defer cancel()
|
||||
daemonName := testutil.MustRandString(t, 63)
|
||||
_, err := templateAdminClient.ServeProvisionerDaemon(ctx, codersdk.ServeProvisionerDaemonRequest{
|
||||
ID: uuid.New(),
|
||||
Name: daemonName,
|
||||
Organization: user.OrganizationID,
|
||||
Provisioners: []codersdk.ProvisionerType{
|
||||
@@ -205,7 +203,6 @@ func TestProvisionerDaemonServe(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
|
||||
defer cancel()
|
||||
_, err := another.ServeProvisionerDaemon(ctx, codersdk.ServeProvisionerDaemonRequest{
|
||||
ID: uuid.New(),
|
||||
Name: testutil.MustRandString(t, 63),
|
||||
Organization: user.OrganizationID,
|
||||
Provisioners: []codersdk.ProvisionerType{
|
||||
@@ -229,7 +226,6 @@ func TestProvisionerDaemonServe(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
|
||||
defer cancel()
|
||||
_, err := another.ServeProvisionerDaemon(ctx, codersdk.ServeProvisionerDaemonRequest{
|
||||
ID: uuid.New(),
|
||||
Name: testutil.MustRandString(t, 63),
|
||||
Organization: user.OrganizationID,
|
||||
Provisioners: []codersdk.ProvisionerType{
|
||||
@@ -360,7 +356,6 @@ func TestProvisionerDaemonServe(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
|
||||
defer cancel()
|
||||
req := codersdk.ServeProvisionerDaemonRequest{
|
||||
ID: uuid.New(),
|
||||
Name: testutil.MustRandString(t, 63),
|
||||
Organization: user.OrganizationID,
|
||||
Provisioners: []codersdk.ProvisionerType{
|
||||
@@ -425,7 +420,6 @@ func TestProvisionerDaemonServe(t *testing.T) {
|
||||
another := codersdk.New(client.URL)
|
||||
pd := provisionerd.New(func(ctx context.Context) (proto.DRPCProvisionerDaemonClient, error) {
|
||||
return another.ServeProvisionerDaemon(ctx, codersdk.ServeProvisionerDaemonRequest{
|
||||
ID: uuid.New(),
|
||||
Name: testutil.MustRandString(t, 63),
|
||||
Organization: user.OrganizationID,
|
||||
Provisioners: []codersdk.ProvisionerType{
|
||||
@@ -503,7 +497,6 @@ func TestProvisionerDaemonServe(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
|
||||
defer cancel()
|
||||
_, err := another.ServeProvisionerDaemon(ctx, codersdk.ServeProvisionerDaemonRequest{
|
||||
ID: uuid.New(),
|
||||
Name: testutil.MustRandString(t, 32),
|
||||
Organization: user.OrganizationID,
|
||||
Provisioners: []codersdk.ProvisionerType{
|
||||
@@ -538,7 +531,6 @@ func TestProvisionerDaemonServe(t *testing.T) {
|
||||
defer cancel()
|
||||
another := codersdk.New(client.URL)
|
||||
_, err := another.ServeProvisionerDaemon(ctx, codersdk.ServeProvisionerDaemonRequest{
|
||||
ID: uuid.New(),
|
||||
Name: testutil.MustRandString(t, 63),
|
||||
Organization: user.OrganizationID,
|
||||
Provisioners: []codersdk.ProvisionerType{
|
||||
@@ -571,7 +563,6 @@ func TestProvisionerDaemonServe(t *testing.T) {
|
||||
defer cancel()
|
||||
another := codersdk.New(client.URL)
|
||||
_, err := another.ServeProvisionerDaemon(ctx, codersdk.ServeProvisionerDaemonRequest{
|
||||
ID: uuid.New(),
|
||||
Name: testutil.MustRandString(t, 63),
|
||||
Organization: user.OrganizationID,
|
||||
Provisioners: []codersdk.ProvisionerType{
|
||||
@@ -698,7 +689,6 @@ func TestProvisionerDaemonServe(t *testing.T) {
|
||||
|
||||
another := codersdk.New(client.URL)
|
||||
srv, err := another.ServeProvisionerDaemon(ctx, codersdk.ServeProvisionerDaemonRequest{
|
||||
ID: uuid.New(),
|
||||
Name: testutil.MustRandString(t, 63),
|
||||
Organization: user.OrganizationID,
|
||||
Provisioners: []codersdk.ProvisionerType{
|
||||
@@ -758,7 +748,6 @@ func TestGetProvisionerDaemons(t *testing.T) {
|
||||
defer cancel()
|
||||
daemonName := testutil.MustRandString(t, 63)
|
||||
srv, err := orgAdmin.ServeProvisionerDaemon(ctx, codersdk.ServeProvisionerDaemonRequest{
|
||||
ID: uuid.New(),
|
||||
Name: daemonName,
|
||||
Organization: org.ID,
|
||||
Provisioners: []codersdk.ProvisionerType{
|
||||
|
||||
Reference in New Issue
Block a user