mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix possible nil pointer exception
It is possible that the node is not yet present in the node list map. In this case just print a warning and return. The next iteration would be fine Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
This commit is contained in:
parent
fefb622447
commit
151f42aeaa
2 changed files with 9 additions and 6 deletions
|
@ -396,11 +396,9 @@ func (n *network) validateConfiguration() error {
|
||||||
driverOptions map[string]string
|
driverOptions map[string]string
|
||||||
opts interface{}
|
opts interface{}
|
||||||
)
|
)
|
||||||
switch data.(type) {
|
switch t := data.(type) {
|
||||||
case map[string]interface{}:
|
case map[string]interface{}, map[string]string:
|
||||||
opts = data.(map[string]interface{})
|
opts = t
|
||||||
case map[string]string:
|
|
||||||
opts = data.(map[string]string)
|
|
||||||
}
|
}
|
||||||
ba, err := json.Marshal(opts)
|
ba, err := json.Marshal(opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -288,7 +288,12 @@ func (nDB *NetworkDB) rejoinClusterBootStrap() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
myself, _ := nDB.nodes[nDB.config.NodeID]
|
myself, ok := nDB.nodes[nDB.config.NodeID]
|
||||||
|
if !ok {
|
||||||
|
nDB.RUnlock()
|
||||||
|
logrus.Warnf("rejoinClusterBootstrap unable to find local node info using ID:%v", nDB.config.NodeID)
|
||||||
|
return
|
||||||
|
}
|
||||||
bootStrapIPs := make([]string, 0, len(nDB.bootStrapIP))
|
bootStrapIPs := make([]string, 0, len(nDB.bootStrapIP))
|
||||||
for _, bootIP := range nDB.bootStrapIP {
|
for _, bootIP := range nDB.bootStrapIP {
|
||||||
// botostrap IPs are usually IP:port from the Join
|
// botostrap IPs are usually IP:port from the Join
|
||||||
|
|
Loading…
Add table
Reference in a new issue