Manager: improve logging when workers register
The info message that a worker registered now also includes its UUID. Any failure hashing the password will now also log the worker name + UUID.
This commit is contained in:
parent
e2559b1181
commit
28cc7b7a3f
@ -33,8 +33,12 @@ func (f *Flamenco) RegisterWorker(e echo.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: validate the request, should at least have non-empty name, secret, and platform.
|
// TODO: validate the request, should at least have non-empty name, secret, and platform.
|
||||||
|
workerUUID := uuid.New()
|
||||||
logger.Info().Str("name", req.Name).Msg("registering new worker")
|
logger = logger.With().
|
||||||
|
Str("name", req.Name).
|
||||||
|
Str("uuid", workerUUID).
|
||||||
|
Logger()
|
||||||
|
logger.Info().Msg("registering new worker")
|
||||||
|
|
||||||
hashedPassword, err := passwordHasher.GenerateHashedPassword([]byte(req.Secret))
|
hashedPassword, err := passwordHasher.GenerateHashedPassword([]byte(req.Secret))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -43,7 +47,7 @@ func (f *Flamenco) RegisterWorker(e echo.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dbWorker := persistence.Worker{
|
dbWorker := persistence.Worker{
|
||||||
UUID: uuid.New(),
|
UUID: workerUUID,
|
||||||
Name: req.Name,
|
Name: req.Name,
|
||||||
Secret: string(hashedPassword),
|
Secret: string(hashedPassword),
|
||||||
Platform: req.Platform,
|
Platform: req.Platform,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user