Skip to content

Commit 3564e68

Browse files
committed
simplify showmotd
1 parent be9fa5a commit 3564e68

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

agent/agentssh/agentssh.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -452,15 +452,10 @@ func (s *Server) startPTYSession(logger slog.Logger, session ptySession, magicTy
452452
}
453453

454454
if !isQuietLogin(s.fs, session.RawCommand()) {
455-
motdFile := s.config.MOTDFile()
456-
if motdFile != "" {
457-
err := showMOTD(s.fs, session, motdFile)
458-
if err != nil {
459-
logger.Error(ctx, "agent failed to show MOTD", slog.Error(err))
460-
s.metrics.sessionErrors.WithLabelValues(magicTypeLabel, "yes", "motd").Add(1)
461-
}
462-
} else {
463-
logger.Warn(ctx, "metadata lookup failed, unable to show MOTD")
455+
err := showMOTD(s.fs, session, s.config.MOTDFile())
456+
if err != nil {
457+
logger.Error(ctx, "agent failed to show MOTD", slog.Error(err))
458+
s.metrics.sessionErrors.WithLabelValues(magicTypeLabel, "yes", "motd").Add(1)
464459
}
465460
}
466461

0 commit comments

Comments
 (0)