Skip to content
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

source: Remove status and status_info from api #85

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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)
})
})
})