agent: Adding some primitive config reloading

pull/19/head
Armon Dadgar 2014-02-07 12:03:14 -08:00
parent 01b1104175
commit e27aa3e21d
1 changed files with 22 additions and 2 deletions

View File

@ -304,8 +304,28 @@ WAIT:
// handleReload is invoked when we should reload our configs, e.g. SIGHUP // handleReload is invoked when we should reload our configs, e.g. SIGHUP
func (c *Command) handleReload(config *Config) *Config { func (c *Command) handleReload(config *Config) *Config {
c.Ui.Output("Reloading configuration...") c.Ui.Output("Reloading configuration...")
// TODO : handle reload newConf := c.readConfig()
return config if newConf == nil {
c.Ui.Error(fmt.Sprintf("Failed to reload configs"))
return config
}
// Change the log level
minLevel := logutils.LogLevel(strings.ToUpper(newConf.LogLevel))
if ValidateLevelFilter(minLevel, c.logFilter) {
c.logFilter.SetMinLevel(minLevel)
} else {
c.Ui.Error(fmt.Sprintf(
"Invalid log level: %s. Valid log levels are: %v",
minLevel, c.logFilter.Levels))
// Keep the current log level
newConf.LogLevel = config.LogLevel
}
// TODO: Update the services and checks
return newConf
} }
func (c *Command) Synopsis() string { func (c *Command) Synopsis() string {