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 7f8cf9e2dc
commit 636b647a30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

3
.changelog/12962.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
agent: fixed a panic on startup when the `server.protocol_version` config parameter was set
```

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