Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitRoushan committed Aug 25, 2021
1 parent 2b8b0be commit 965dffc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/csi/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,20 @@ func newBackend(backendName string, config map[string]interface{}) (*Backend, er
}

supportedTopologies := make([]map[string]string, 0)
if _, exist = config[SupportedTopologies]; exist {
topologies, ok := config[SupportedTopologies].([]map[string]string)
if topologies, exist := config[SupportedTopologies]; exist {
topologyArray , ok := topologies.([]map[string]interface{})
if !ok {
return nil, errors.New("invalid supported topologies configuration")
}
supportedTopologies = topologies
for _, topologyMap := range topologyArray {
tempMap := make(map[string]string, 0)
for topologyKey, value := range topologyMap {
if topologyValue, ok := value.(string); ok {
tempMap[topologyKey] = topologyValue
}
}
supportedTopologies = append(supportedTopologies, tempMap)
}
}

plugin := plugin.GetPlugin(storage)
Expand Down

0 comments on commit 965dffc

Please sign in to comment.