feat: agent specifications query and get endpoints
All checks were successful
arcad/emissary/pipeline/head This commit looks good
All checks were successful
arcad/emissary/pipeline/head This commit looks good
This commit is contained in:
@ -45,17 +45,29 @@ func (c *Controller) reconcileAgent(ctx context.Context, client *client.Client,
|
||||
return nil
|
||||
}
|
||||
|
||||
specs, err := client.GetAgentSpecs(ctx, agent.ID)
|
||||
specHeaders, err := client.QueryAgentSpecs(ctx, agent.ID)
|
||||
if err != nil {
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not retrieve agent specs", logger.CapturedE(err))
|
||||
logger.Error(ctx, "could not query agent specs", logger.CapturedE(err))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
state.ClearSpecs()
|
||||
|
||||
for _, spec := range specs {
|
||||
for _, sh := range specHeaders {
|
||||
spec, err := client.GetAgentSpec(ctx, agent.ID, sh.DefinitionName, sh.DefinitionVersion)
|
||||
if err != nil {
|
||||
logger.Error(
|
||||
ctx, "could not retrieve agent spec",
|
||||
logger.F("specName", sh.DefinitionName),
|
||||
logger.F("specVersion", sh.DefinitionVersion),
|
||||
logger.CapturedE(errors.WithStack(err)),
|
||||
)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
state.SetSpec(spec)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user