local state: clone check to avoid side effect

This commit is contained in:
Frank Schroeder 2017-10-20 06:41:12 +02:00
parent b36613e7ff
commit f5a3d73b27
No known key found for this signature in database
GPG Key ID: 4D65C6EAEC87DECD
1 changed files with 3 additions and 0 deletions

View File

@ -335,6 +335,9 @@ func (l *State) AddCheck(check *structs.HealthCheck, token string) error {
return fmt.Errorf("no check") return fmt.Errorf("no check")
} }
// clone the check since we will be modifying it.
check = check.Clone()
if l.discardCheckOutput.Load().(bool) { if l.discardCheckOutput.Load().(bool) {
check.Output = "" check.Output = ""
} }