mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-04 06:54:45 +08:00
配置检查nodeid是否存在
This commit is contained in:
@@ -2,6 +2,7 @@ package cluster
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
)
|
||||
@@ -69,6 +70,10 @@ func ReadCfg(path string, nodeid int) (*ClusterConfig, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if c.currentNode.NodeID == 0 {
|
||||
return nil, errors.New(fmt.Sprintf("Cannot find NodeId %d in cluster.json!", nodeid))
|
||||
}
|
||||
|
||||
//3.存入当前Node服务名
|
||||
c.mapClusterNodeService[c.currentNode.NodeName] = append(c.mapClusterNodeService[c.currentNode.NodeName], c.currentNode)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user