Convert deprecated [cluster] config to [coordinator]

pull/6604/head
Jason Wilder 2016-05-11 12:35:19 -06:00
parent 6cc1a34704
commit 75e89e35d8
2 changed files with 16 additions and 0 deletions

View File

@ -140,6 +140,16 @@ func (c *Config) FromToml(input string) error {
log.Printf("deprecated config option %s replaced with %s; %s will not be supported in a future release\n", in, out, in)
return out
})
// Replace deprecated [cluster] with [coordinator]
re = regexp.MustCompile(`(?m)^\s*\[(cluster)\]`)
input = re.ReplaceAllStringFunc(input, func(in string) string {
in = strings.TrimSpace(in)
out := "[coordinator]"
log.Printf("deprecated config option %s replaced with %s; %s will not be supported in a future release\n", in, out, in)
return out
})
_, err := toml.Decode(input, c)
return err
}

View File

@ -252,6 +252,9 @@ bind-address = ":1000"
[opentsdb]
bind-address = ":2000"
[cluster]
max-select-point = 100
`); err != nil {
t.Fatal(err)
}
@ -261,5 +264,8 @@ bind-address = ":2000"
t.Fatalf("unexpected collectd bind address: %s", c.CollectdInputs[0].BindAddress)
} else if c.OpenTSDBInputs[0].BindAddress != ":2000" {
t.Fatalf("unexpected opentsdb bind address: %s", c.OpenTSDBInputs[0].BindAddress)
} else if c.Coordinator.MaxSelectPointN != 100 {
t.Fatalf("unexpected coordinator max select points: %s", c.Coordinator.MaxSelectPointN)
}
}