Skip to content

Commit

Permalink
agent: fix panic when logging about protocol version config use. (#12962
Browse files Browse the repository at this point in the history
)

The log line comes before the agent logger has been setup,
therefore we need to use the UI logging to avoid panic.
  • Loading branch information
jrasell authored and lgfa29 committed May 19, 2022
1 parent 3c71ff1 commit e79bc2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/12962.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
agent: fixed a panic on startup when the `server.protocol_version` config parameter was set
```
2 changes: 1 addition & 1 deletion command/agent/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,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
Expand Down

0 comments on commit e79bc2e

Please sign in to comment.