Fix to properly return the backend cluster on a query.
Change-Id: I18695652987db2ce8bd0004a19b7efeac53cb9b9
diff --git a/afrouter/afrouter/api.go b/afrouter/afrouter/api.go
index 8235525..7f7ba54 100644
--- a/afrouter/afrouter/api.go
+++ b/afrouter/afrouter/api.go
@@ -104,7 +104,8 @@
return b,nil
}
}
- err := errors.New(fmt.Sprintf("Backend '%s' doesn't exist", bknd))
+ err := errors.New(fmt.Sprintf("Backend '%s' doesn't exist in cluster %s",
+ bknd, c.name))
return nil, err
}
@@ -172,7 +173,6 @@
}
func (aa ArouterApi) SetConnection(ctx context.Context, in *pb.Conn) (*pb.Result, error) {
- log.Debugf("SetConnection called! %v",in);
// Navigate down tot he connection and compare IP addresses and ports if they're
// not the same then close the existing connection. If they are bothe the same
// then return an error describing the situation.
@@ -182,9 +182,12 @@
var cn * beConnection
var err error
+ log.Debugf("SetConnection called! %v",in);
+
aap := &aa
if s,err = (aap).getServer(in.Server); err != nil {
err := errors.New(fmt.Sprintf("Server '%s' doesn't exist", in.Server))
+ log.Error(err)
return &pb.Result{Success:false,Error:err.Error()}, err
}
// The cluster is usually accessed via tha router but since each
@@ -192,18 +195,22 @@
// has the cluster we're looking for rather than fully keying
// the path
if c,err = aap.getCluster(s, in.Cluster); err != nil {
+ log.Error(err)
return &pb.Result{Success:false,Error:err.Error()}, err
}
if b,err = aap.getBackend(c, in.Backend); err != nil {
+ log.Error(err)
return &pb.Result{Success:false,Error:err.Error()}, err
}
if cn,err = aap.getConnection(b, in.Connection); err != nil {
+ log.Error(err)
return &pb.Result{Success:false,Error:err.Error()}, err
}
if err = aap.updateConnection(in, cn, b); err != nil {
+ log.Error(err)
return &pb.Result{Success:false,Error:err.Error()}, err
}