mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-07-10 00:14:38 +00:00
fix: Add clear warning when Docker token is already in use
When a Docker agent tries to register with a token that's already bound to another agent, the error was logged generically as "Failed to send docker report". Users had to dig into logs to understand the issue. Now logs a prominent error message: "DOCKER REGISTRATION FAILED: This API token is already used by another Docker agent. Each Docker host requires its own unique token. Generate a new token in Pulse Settings > Agents and reinstall with the new token." Related to #1027
This commit is contained in:
parent
22e1cc5613
commit
fd7e80ae17
1 changed files with 8 additions and 0 deletions
|
|
@ -699,6 +699,14 @@ func (a *Agent) sendReportToTarget(ctx context.Context, target TargetConfig, pay
|
|||
if errMsg == "" {
|
||||
errMsg = resp.Status
|
||||
}
|
||||
// Detect token-already-in-use error and log a clear warning
|
||||
if strings.Contains(errMsg, "already in use") {
|
||||
a.logger.Error().
|
||||
Str("pulseURL", target.URL).
|
||||
Msg("DOCKER REGISTRATION FAILED: This API token is already used by another Docker agent. " +
|
||||
"Each Docker host requires its own unique token. " +
|
||||
"Generate a new token in Pulse Settings > Agents and reinstall with the new token.")
|
||||
}
|
||||
return fmt.Errorf("target %s: pulse responded %s: %s", target.URL, resp.Status, errMsg)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue