mirror of https://github.com/status-im/consul.git
Merge pull request #3821 from hashicorp/persist-file-handling
Add graceful handling of malformed persisted service/check files.
This commit is contained in:
commit
cde1e7ceb6
|
@ -2155,7 +2155,8 @@ func (a *Agent) loadServices(conf *config.RuntimeConfig) error {
|
|||
if err := json.Unmarshal(buf, &p); err != nil {
|
||||
// Backwards-compatibility for pre-0.5.1 persisted services
|
||||
if err := json.Unmarshal(buf, &p.Service); err != nil {
|
||||
return fmt.Errorf("failed decoding service file %q: %s", file, err)
|
||||
a.logger.Printf("[ERR] Failed decoding service file %q: %s", file, err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
serviceID := p.Service.ID
|
||||
|
@ -2234,7 +2235,8 @@ func (a *Agent) loadChecks(conf *config.RuntimeConfig) error {
|
|||
// Decode the check
|
||||
var p persistedCheck
|
||||
if err := json.Unmarshal(buf, &p); err != nil {
|
||||
return fmt.Errorf("Failed decoding check file %q: %s", file, err)
|
||||
a.logger.Printf("[ERR] Failed decoding check file %q: %s", file, err)
|
||||
continue
|
||||
}
|
||||
checkID := p.Check.CheckID
|
||||
|
||||
|
|
Loading…
Reference in New Issue