agent: fix panic when logging about protocol version config use. (#12962)

The log line comes before the agent logger has been setup,
therefore we need to use the UI logging to avoid panic.
This commit is contained in:
James Rasell
2022-05-13 09:28:43 +02:00
committed by GitHub
parent e611b099d3
commit bab219a8ba
2 changed files with 4 additions and 1 deletions

View File

@@ -436,7 +436,7 @@ func (c *Command) IsValidConfig(config, cmdConfig *Config) bool {
// ProtocolVersion has never been used. Warn if it is set as someone
// has probably made a mistake.
if config.Server.ProtocolVersion != 0 {
c.agent.logger.Warn("Please remove deprecated protocol_version field from config.")
c.Ui.Warn("Please remove deprecated protocol_version field from config.")
}
return true