From 5695d8e022410d58e2ad00af28a4668a204c087b Mon Sep 17 00:00:00 2001 From: Julia Bardi Date: Tue, 6 Sep 2022 14:26:32 +0200 Subject: [PATCH 1/3] updating upgrade_status: completed --- internal/pkg/api/handleAck.go | 1 + internal/pkg/dl/constants.go | 1 + internal/pkg/model/schema.go | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/pkg/api/handleAck.go b/internal/pkg/api/handleAck.go index 3f284b5dae..b3febcfd85 100644 --- a/internal/pkg/api/handleAck.go +++ b/internal/pkg/api/handleAck.go @@ -421,6 +421,7 @@ func (ack *AckT) handleUpgrade(ctx context.Context, zlog zerolog.Logger, agent * doc := bulk.UpdateFields{ dl.FieldUpgradeStartedAt: nil, dl.FieldUpgradedAt: now, + dl.FieldUpgradeStatus: "completed", } body, err := doc.Marshal() diff --git a/internal/pkg/dl/constants.go b/internal/pkg/dl/constants.go index 14c5bc7a65..9fb0614da7 100644 --- a/internal/pkg/dl/constants.go +++ b/internal/pkg/dl/constants.go @@ -49,6 +49,7 @@ const ( FieldUnenrolledAt = "unenrolled_at" FieldUpgradedAt = "upgraded_at" FieldUpgradeStartedAt = "upgrade_started_at" + FieldUpgradeStatus = "upgrade_status" FieldDecodedSha256 = "decoded_sha256" FieldIdentifier = "identifier" diff --git a/internal/pkg/model/schema.go b/internal/pkg/model/schema.go index fca90db0b7..15623c305e 100644 --- a/internal/pkg/model/schema.go +++ b/internal/pkg/model/schema.go @@ -139,7 +139,7 @@ type Agent struct { // Date/time the Elastic Agent checked in last time LastCheckin string `json:"last_checkin,omitempty"` - // Lst checkin status + // Last checkin status LastCheckinStatus string `json:"last_checkin_status,omitempty"` // Date/time the Elastic Agent was last updated @@ -190,6 +190,9 @@ type Agent struct { // Date/time the Elastic Agent was last upgraded UpgradedAt string `json:"upgraded_at,omitempty"` + // Upgrade status + UpgradeStatus string `json:"upgrade_status,omitempty"` + // User provided metadata information for the Elastic Agent UserProvidedMetadata json.RawMessage `json:"user_provided_metadata,omitempty"` } From b93652f205c0a65387e74b8c84f5c7b6ce09c626 Mon Sep 17 00:00:00 2001 From: Julia Bardi Date: Tue, 6 Sep 2022 16:41:30 +0200 Subject: [PATCH 2/3] updated schema.json and regenerated schema.go --- internal/pkg/model/schema.go | 10 +++------- licenses/license_header.go | 19 ++++++++++++++++--- model/schema.json | 6 +++++- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/internal/pkg/model/schema.go b/internal/pkg/model/schema.go index 15623c305e..515f838ae4 100644 --- a/internal/pkg/model/schema.go +++ b/internal/pkg/model/schema.go @@ -1,7 +1,3 @@ -// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -// or more contributor license agreements. Licensed under the Elastic License; -// you may not use this file except in compliance with the Elastic License. - // Code generated by schema-generate. DO NOT EDIT. package model @@ -187,12 +183,12 @@ type Agent struct { // Date/time the Elastic Agent started the current upgrade UpgradeStartedAt string `json:"upgrade_started_at,omitempty"` - // Date/time the Elastic Agent was last upgraded - UpgradedAt string `json:"upgraded_at,omitempty"` - // Upgrade status UpgradeStatus string `json:"upgrade_status,omitempty"` + // Date/time the Elastic Agent was last upgraded + UpgradedAt string `json:"upgraded_at,omitempty"` + // User provided metadata information for the Elastic Agent UserProvidedMetadata json.RawMessage `json:"user_provided_metadata,omitempty"` } diff --git a/licenses/license_header.go b/licenses/license_header.go index 21a8501aac..fc5125bb2f 100644 --- a/licenses/license_header.go +++ b/licenses/license_header.go @@ -1,6 +1,19 @@ -// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -// or more contributor license agreements. Licensed under the Elastic License; -// you may not use this file except in compliance with the Elastic License. +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. // Code generated by beats/dev-tools/cmd/license/license_generate.go - DO NOT EDIT. diff --git a/model/schema.json b/model/schema.json index 09eda21a9c..91bda492f8 100644 --- a/model/schema.json +++ b/model/schema.json @@ -401,6 +401,10 @@ "type": "string", "format": "date-time" }, + "upgrade_status": { + "description": "Upgrade status", + "type": "string" + }, "access_api_key_id": { "description": "ID of the API key the Elastic Agent must used to contact Fleet Server", "type": "string" @@ -451,7 +455,7 @@ "format": "date-time" }, "last_checkin_status": { - "description": "Lst checkin status", + "description": "Last checkin status", "type": "string" }, "default_api_key_id": { From def7d3a15ba63d0b9c277634ff1654f6ec905faa Mon Sep 17 00:00:00 2001 From: Julia Bardi Date: Wed, 7 Sep 2022 08:49:15 +0200 Subject: [PATCH 3/3] updated license headers --- internal/pkg/model/schema.go | 4 ++++ licenses/license_header.go | 19 +++---------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/internal/pkg/model/schema.go b/internal/pkg/model/schema.go index 515f838ae4..9fb0d07fc3 100644 --- a/internal/pkg/model/schema.go +++ b/internal/pkg/model/schema.go @@ -1,3 +1,7 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + // Code generated by schema-generate. DO NOT EDIT. package model diff --git a/licenses/license_header.go b/licenses/license_header.go index fc5125bb2f..21a8501aac 100644 --- a/licenses/license_header.go +++ b/licenses/license_header.go @@ -1,19 +1,6 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. // Code generated by beats/dev-tools/cmd/license/license_generate.go - DO NOT EDIT.