mirror of
https://github.com/status-im/consul.git
synced 2025-02-16 23:57:07 +00:00
Validate ServiceID/CheckID when deregistering.
This commit is contained in:
parent
8bfc337a75
commit
401bc71cb2
@ -637,6 +637,11 @@ func (a *Agent) RemoveService(serviceID string, persist bool) error {
|
|||||||
consul.ConsulServiceID)
|
consul.ConsulServiceID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate ServiceID
|
||||||
|
if serviceID == "" {
|
||||||
|
return fmt.Errorf("ServiceID missing")
|
||||||
|
}
|
||||||
|
|
||||||
// Remove service immeidately
|
// Remove service immeidately
|
||||||
a.state.RemoveService(serviceID)
|
a.state.RemoveService(serviceID)
|
||||||
|
|
||||||
@ -757,6 +762,11 @@ func (a *Agent) AddCheck(check *structs.HealthCheck, chkType *CheckType, persist
|
|||||||
// RemoveCheck is used to remove a health check.
|
// RemoveCheck is used to remove a health check.
|
||||||
// The agent will make a best effort to ensure it is deregistered
|
// The agent will make a best effort to ensure it is deregistered
|
||||||
func (a *Agent) RemoveCheck(checkID string, persist bool) error {
|
func (a *Agent) RemoveCheck(checkID string, persist bool) error {
|
||||||
|
// Validate CheckID
|
||||||
|
if checkID == "" {
|
||||||
|
return fmt.Errorf("CheckID missing")
|
||||||
|
}
|
||||||
|
|
||||||
// Add to the local state for anti-entropy
|
// Add to the local state for anti-entropy
|
||||||
a.state.RemoveCheck(checkID)
|
a.state.RemoveCheck(checkID)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user