Skip to content

Commit

Permalink
fix: handled nameservices in svm zapi plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Hardikl committed Aug 27, 2024
1 parent 014dce0 commit 9002c41
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cmd/collectors/zapi/plugins/svm/svm.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ func (my *SVM) GetNSSwitchInfo() (map[string]Nsswitch, error) {
result []*node.Node
request *node.Node
vserverNsswitchMap map[string]Nsswitch
ns Nsswitch
ok bool
err error
)
Expand All @@ -371,16 +370,17 @@ func (my *SVM) GetNSSwitchInfo() (map[string]Nsswitch, error) {
}

for _, nsswitchConfig := range result {
nsdb := nsswitchConfig.GetChildContentS("nameservice-database")
var ns Nsswitch
svmName := nsswitchConfig.GetChildContentS("vserver-name")
nssource := nsswitchConfig.GetChildS("nameservice-sources")
nssourcelist := nssource.GetAllChildContentS()

if ns, ok = vserverNsswitchMap[svmName]; ok {
ns.nsdb = append(ns.nsdb, nsdb)
ns.nssource = append(ns.nssource, nssourcelist...)
} else {
ns = Nsswitch{nsdb: []string{nsdb}, nssource: nssourcelist}
if nssource := nsswitchConfig.GetChildS("nameservice-sources"); nssource != nil {
nssourcelist := nssource.GetAllChildContentS()
nsdb := nsswitchConfig.GetChildContentS("nameservice-database")
if ns, ok = vserverNsswitchMap[svmName]; ok {
ns.nsdb = append(ns.nsdb, nsdb)
ns.nssource = append(ns.nssource, nssourcelist...)
} else {
ns = Nsswitch{nsdb: []string{nsdb}, nssource: nssourcelist}
}
}
vserverNsswitchMap[svmName] = ns
}
Expand Down

0 comments on commit 9002c41

Please sign in to comment.