From a75b7273918091558e6e56f3a29824742515c5af Mon Sep 17 00:00:00 2001 From: foostan Date: Tue, 27 Jan 2015 18:11:57 +0900 Subject: [PATCH] Validation ServiceID/CheckID when deleting in deleteService() in local.go --- command/agent/local.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/command/agent/local.go b/command/agent/local.go index 1a394f4e9..38b5ee169 100644 --- a/command/agent/local.go +++ b/command/agent/local.go @@ -1,6 +1,7 @@ package agent import ( + "fmt" "log" "reflect" "strings" @@ -408,6 +409,10 @@ func (l *localState) syncChanges() error { // deleteService is used to delete a service from the server func (l *localState) deleteService(id string) error { + if id == "" { + return fmt.Errorf("ServiceID missing") + } + req := structs.DeregisterRequest{ Datacenter: l.config.Datacenter, Node: l.config.NodeName, @@ -425,6 +430,10 @@ func (l *localState) deleteService(id string) error { // deleteCheck is used to delete a service from the server func (l *localState) deleteCheck(id string) error { + if id == "" { + return fmt.Errorf("CheckID missing") + } + req := structs.DeregisterRequest{ Datacenter: l.config.Datacenter, Node: l.config.NodeName,