From 839f22e1a36dbfa0ddd1bf10338fe0a7732bb09a Mon Sep 17 00:00:00 2001 From: aarifullin Date: Mon, 4 Mar 2024 18:00:59 +0300 Subject: [PATCH] [#55] router: Inmemory implementation should take empty name for "root" Signed-off-by: Airat Arifullin --- pkg/engine/inmemory/local_storage.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/engine/inmemory/local_storage.go b/pkg/engine/inmemory/local_storage.go index 0324df2..9cbeed9 100644 --- a/pkg/engine/inmemory/local_storage.go +++ b/pkg/engine/inmemory/local_storage.go @@ -77,6 +77,9 @@ func (s *inmemoryLocalStorage) GetOverride(name chain.Name, target engine.Target if _, ok := s.nameToResourceChains[name]; !ok { return nil, engine.ErrChainNameNotFound } + if target.Name == "" { + target.Name = "root" + } chains, ok := s.nameToResourceChains[name][target] if !ok { return nil, engine.ErrResourceNotFound @@ -96,6 +99,9 @@ func (s *inmemoryLocalStorage) RemoveOverride(name chain.Name, target engine.Tar if _, ok := s.nameToResourceChains[name]; !ok { return engine.ErrChainNameNotFound } + if target.Name == "" { + target.Name = "root" + } chains, ok := s.nameToResourceChains[name][target] if !ok { return engine.ErrResourceNotFound @@ -117,6 +123,9 @@ func (s *inmemoryLocalStorage) ListOverrides(name chain.Name, target engine.Targ if !ok { return []*chain.Chain{}, nil } + if target.Name == "" { + target.Name = "root" + } for t, chains := range rcs { if t.Type != target.Type { continue