Skip to content

Commit

Permalink
source: Remove status and status_info from api
Browse files Browse the repository at this point in the history
Signed-off-by: Cosmin Tupangiu <[email protected]>
  • Loading branch information
tupyy authored and machacekondra committed Nov 28, 2024
1 parent f8a55e9 commit 3427a9c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}()
Expand Down
3 changes: 1 addition & 2 deletions internal/agent/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion internal/agent/inventory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})
})

0 comments on commit 3427a9c

Please sign in to comment.