dctree filter

This commit is contained in:
Pavel Vorobyov
2020-07-03 11:55:29 +03:00
parent 4f12f5de04
commit a6fd56b667

View File

@@ -202,6 +202,7 @@ func (s *Store) HostList(expr []rune) ([]string, error) {
}
}
}
etoken.hosts = append(etoken.hosts, host)
}
@@ -216,10 +217,20 @@ func (s *Store) HostList(expr []rune) ([]string, error) {
continue
}
if host.Datacenter.Name != token.DatacenterFilter {
// TODO tree
hostDC := host.Datacenter.Parent
parentMatch := false
for hostDC != nil {
if hostDC.Name == token.DatacenterFilter {
parentMatch = true
break
}
hostDC = hostDC.Parent
}
if !parentMatch {
continue
}
}
}
for _, tag := range token.TagsFilter {
if !stringslice.Contains(host.AllTags, tag) {
@@ -265,10 +276,20 @@ func (s *Store) HostList(expr []rune) ([]string, error) {
continue
}
if host.Datacenter.Name != token.DatacenterFilter {
// TODO tree
hostDC := host.Datacenter.Parent
parentMatch := false
for hostDC != nil {
if hostDC.Name == token.DatacenterFilter {
parentMatch = true
break
}
hostDC = hostDC.Parent
}
if !parentMatch {
continue
}
}
}
for _, tag := range token.TagsFilter {
if !stringslice.Contains(host.AllTags, tag) {