feat: basic authorization model
This commit is contained in:
@ -21,22 +21,15 @@ func (c *Controller) Name() string {
|
||||
func (c *Controller) Reconcile(ctx context.Context, state *agent.State) error {
|
||||
cl := agent.Client(ctx)
|
||||
|
||||
agents, _, err := cl.QueryAgents(
|
||||
agent, err := cl.GetAgent(
|
||||
ctx,
|
||||
client.WithQueryAgentsLimit(1),
|
||||
client.WithQueryAgentsID(state.AgentID()),
|
||||
state.AgentID(),
|
||||
)
|
||||
if err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
|
||||
if len(agents) == 0 {
|
||||
logger.Error(ctx, "could not find remote matching agent")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := c.reconcileAgent(ctx, cl, state, agents[0]); err != nil {
|
||||
if err := c.reconcileAgent(ctx, cl, state, agent); err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user