From d999de284898edf58a12b204514709bff6fcbf84 Mon Sep 17 00:00:00 2001 From: Cosmin Tupangiu Date: Thu, 28 Nov 2024 14:14:12 +0100 Subject: [PATCH] source: Remove status and status_info from api Signed-off-by: Cosmin Tupangiu --- internal/agent/agent.go | 2 +- internal/agent/inventory.go | 3 +-- internal/agent/inventory_test.go | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/agent/agent.go b/internal/agent/agent.go index 90690c6..c3bc587 100644 --- a/internal/agent/agent.go +++ b/internal/agent/agent.go @@ -163,7 +163,7 @@ func (a *Agent) start(ctx context.Context, plannerClient client.Planner) { } if status == api.AgentStatusUpToDate { - inventoryUpdater.UpdateServiceWithInventory(ctx, api.SourceStatusUpToDate, "Inventory collected with success", inventory) + inventoryUpdater.UpdateServiceWithInventory(ctx, inventory) } } }() diff --git a/internal/agent/inventory.go b/internal/agent/inventory.go index ab11ed1..7042394 100644 --- a/internal/agent/inventory.go +++ b/internal/agent/inventory.go @@ -34,7 +34,7 @@ func NewInventoryUpdater(log *log.PrefixLogger, agentID uuid.UUID, client client return updater } -func (u *InventoryUpdater) UpdateServiceWithInventory(ctx context.Context, status api.SourceStatus, statusInfo string, inventory *api.Inventory) { +func (u *InventoryUpdater) UpdateServiceWithInventory(ctx context.Context, inventory *api.Inventory) { update := agentapi.SourceStatusUpdate{ Inventory: *inventory, AgentId: u.agentID, @@ -49,7 +49,6 @@ func (u *InventoryUpdater) UpdateServiceWithInventory(ctx context.Context, statu return } - u.log.Debugf("Updating status to %s: %s", string(status), statusInfo) err = u.client.UpdateSourceStatus(ctx, uuid.MustParse(inventory.Vcenter.Id), update) if err != nil { u.log.Errorf("failed updating status: %v", err) diff --git a/internal/agent/inventory_test.go b/internal/agent/inventory_test.go index 428cefd..e772bbd 100644 --- a/internal/agent/inventory_test.go +++ b/internal/agent/inventory_test.go @@ -40,7 +40,7 @@ var _ = Describe("Inventory", func() { Vcenter: api.VCenter{Id: sourceID.String()}, } inventoryUpdater := agent.NewInventoryUpdater(log.NewPrefixLogger(""), agentID, &client) - inventoryUpdater.UpdateServiceWithInventory(context.TODO(), api.SourceStatusUpToDate, "status_info", inventory) + inventoryUpdater.UpdateServiceWithInventory(context.TODO(), inventory) }) }) })