mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
agent: Fix misaligned contextual k/v logging arguments. (#25629)
Arguments passed to hclog log lines should always have an even number to provide the expected k/v output.
This commit is contained in:
@@ -97,7 +97,7 @@ func (h *apiHook) Stop(ctx context.Context, req *interfaces.TaskStopRequest, res
|
||||
if h.ln != nil {
|
||||
if err := h.ln.Close(); err != nil {
|
||||
if !errors.Is(err, net.ErrClosed) {
|
||||
h.logger.Debug("error closing task listener: %v", err)
|
||||
h.logger.Debug("error closing task listener", "error", err)
|
||||
}
|
||||
}
|
||||
h.ln = nil
|
||||
|
||||
@@ -77,7 +77,7 @@ func (h *dynamicUsersHook) Prestart(_ context.Context, request *interfaces.TaskP
|
||||
// allocate an unused UID/GID from the pool
|
||||
ugid, err := h.pool.Acquire()
|
||||
if err != nil {
|
||||
h.logger.Error("unable to acquire anonymous UID/GID: %v", err)
|
||||
h.logger.Error("unable to acquire anonymous UID/GID", "error", err)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -134,12 +134,13 @@ func (h *identityHook) watchIdentity(wid *structs.WorkloadIdentity, runCh chan s
|
||||
if signedWID == nil {
|
||||
// The only way to hit this should be a bug as it indicates the server
|
||||
// did not sign an identity for a task on this alloc.
|
||||
h.logger.Error("missing workload identity %q", wid.Name)
|
||||
h.logger.Error("missing workload identity", "identity", wid.Name)
|
||||
return
|
||||
}
|
||||
|
||||
if err := h.setAltToken(wid, signedWID.JWT); err != nil {
|
||||
h.logger.Error(err.Error())
|
||||
h.logger.Error("failed to set workload identity token",
|
||||
"identity", wid.Name, "error", err)
|
||||
}
|
||||
|
||||
// Skip ChangeMode on firstRun and notify caller it can proceed
|
||||
@@ -148,7 +149,8 @@ func (h *identityHook) watchIdentity(wid *structs.WorkloadIdentity, runCh chan s
|
||||
case runCh <- struct{}{}:
|
||||
default:
|
||||
// Not great but not necessarily fatal
|
||||
h.logger.Warn("task started before identity %q was fetched", wid.Name)
|
||||
h.logger.Warn("task started before identity was fetched",
|
||||
"identity", wid.Name)
|
||||
}
|
||||
|
||||
firstRun = false
|
||||
|
||||
Reference in New Issue
Block a user