del stras if node not exists
This commit is contained in:
parent
3534aa7e69
commit
97acc7d1d0
|
@ -230,6 +230,11 @@ func StraDel(id int64) error {
|
||||||
return session.Commit()
|
return session.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func StraDelByNid(nid int64) error {
|
||||||
|
_, err := DB["mon"].Where("nid=?", nid).Delete(new(Stra))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func StrasList(name string, priority int, nid int64) ([]*Stra, error) {
|
func StrasList(name string, priority int, nid int64) ([]*Stra, error) {
|
||||||
session := DB["mon"].NewSession()
|
session := DB["mon"].NewSession()
|
||||||
defer session.Close()
|
defer session.Close()
|
||||||
|
|
|
@ -577,6 +577,8 @@ func GetLeafNidsForMon(nid int64, exclNid []int64) ([]int64, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if node == nil {
|
if node == nil {
|
||||||
|
// 节点已经被删了,相关的告警策略也删除
|
||||||
|
StraDelByNid(nid)
|
||||||
return []int64{}, nil
|
return []int64{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue