Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ func (h *PolicyReassign) Handle(ctx context.Context, a fleetapi.Action, acker ac
h.log.Debugf("handlerPolicyReassign: action '%+v' received", a)

if err := acker.Ack(ctx, a); err != nil {
h.log.Errorf("failed to acknowledge POLICY_REASSIGN action with id '%s'", a.ID)
h.log.Errorf("failed to acknowledge POLICY_REASSIGN action with id '%s'", a.ID())
} else if err := acker.Commit(ctx); err != nil {
h.log.Errorf("failed to commit acker after acknowledging action with id '%s'", a.ID)
h.log.Errorf("failed to commit acker after acknowledging action with id '%s'", a.ID())
}

return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,20 @@ func (btr *BackoffRoundTripper) RoundTrip(req *http.Request) (*http.Response, er
if resettableBody != nil {
_, err = resettableBody.Seek(0, io.SeekStart)
if err != nil {
btr.logger.Errorf("error while resetting request body: %w", err)
btr.logger.Errorf("error while resetting request body: %v", err)
}
}

attempt++
resp, err = btr.next.RoundTrip(req) //nolint:bodyclose // the response body is closed when status code >= 400 or it is closed by the caller
if err != nil {
btr.logger.Errorf("attempt %d: error round-trip: %w", err)
btr.logger.Errorf("attempt %d: error round-trip: %v", attempt, err)
return err
}

if resp.StatusCode >= 400 {
if err := resp.Body.Close(); err != nil {
btr.logger.Errorf("attempt %d: error closing the response body: %w", attempt, err)
btr.logger.Errorf("attempt %d: error closing the response body: %v", attempt, err)
}
btr.logger.Errorf("attempt %d: received response status: %d", attempt, resp.StatusCode)
return errors.New(fmt.Sprintf("received response status: %d", resp.StatusCode))
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/agent/migration/migrate_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ func MigrateToEncryptedConfig(ctx context.Context, l *logp.Logger, unencryptedCo

unencStat, unencFileErr := os.Stat(unencryptedConfigPath)

l.Debugf(fmt.Sprintf("checking stat of enc config %q: %+v, err: %v", encryptedConfigPath, encStat, encFileErr))
l.Debugf(fmt.Sprintf("checking stat of unenc config %q: %+v, err: %v", unencryptedConfigPath, unencStat, unencFileErr))
l.Debugf("checking stat of enc config %q: %+v, err: %v", encryptedConfigPath, encStat, encFileErr)
l.Debugf("checking stat of unenc config %q: %+v, err: %v", unencryptedConfigPath, unencStat, unencFileErr)

isEncryptedConfigEmpty := errors.Is(encFileErr, fs.ErrNotExist) || encStat.Size() == 0
isUnencryptedConfigPresent := unencFileErr == nil && unencStat.Size() > 0
Expand All @@ -54,7 +54,7 @@ func MigrateToEncryptedConfig(ctx context.Context, l *logp.Logger, unencryptedCo
defer func() {
err = reader.Close()
if err != nil {
l.Errorf(fmt.Sprintf("Error closing unencrypted store reader for %q: %v", unencryptedConfigPath, err))
l.Errorf("Error closing unencrypted store reader for %q: %v", unencryptedConfigPath, err)
}
}()
store, err := storage.NewEncryptedDiskStore(ctx, encryptedConfigPath, storageOpts...)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (p *dynamicProvider) watchResource(
}
p.config.Node, err = kubernetes.DiscoverKubernetesNode(p.logger, nd)
if err != nil {
p.logger.Debugf("Kubernetes provider skipped, unable to discover node: %w", err)
p.logger.Debugf("Kubernetes provider skipped, unable to discover node: %v", err)
return nil, nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/config/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (l *Loader) Load(files []string) (*Config, error) {
return nil, fmt.Errorf("cannot get configuration from '%s': %w", f, err)
}
inputsList = append(inputsList, inp...)
l.logger.Debugf("Loaded %s input(s) from configuration from %s", len(inp), f)
l.logger.Debugf("Loaded %d input(s) from configuration from %s", len(inp), f)
} else {
if err := merger.Add(cfg.access(), err); err != nil {
return nil, fmt.Errorf("failed to merge configuration file '%s' to existing one: %w", f, err)
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/remote/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func (c *Client) Send(
errs = append(errs, fmt.Errorf("%s: %w", msg, err))

// Using debug level as the error is only relevant if all clients fail.
c.log.With("error", err).Debugf(msg)
c.log.With("error", err).Debug(msg)
continue
}
c.checkApiVersionHeaders(req, resp)
Expand Down
2 changes: 1 addition & 1 deletion pkg/testing/ess/serverless_provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (log *defaultLogger) Logf(format string, args ...any) {
if len(args) == 0 {

} else {
log.wrapped.Infof(format, args)
log.wrapped.Infof(format, args...)
}

}
Expand Down
Loading