Skip to content

Commit 7e2c728

Browse files
committed
[apricot] Don't crash because of nil getStringMap
1 parent 3cb776c commit 7e2c728

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

apricot/local/serviceutil.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ package local
2727
import (
2828
"errors"
2929
"fmt"
30-
"github.com/spf13/viper"
3130
"strings"
3231

32+
"github.com/spf13/viper"
33+
3334
"github.com/AliceO2Group/Control/configuration/cfgbackend"
3435
"github.com/AliceO2Group/Control/configuration/componentcfg"
3536
)
@@ -78,7 +79,10 @@ func (s *Service) queryToAbsPath(query *componentcfg.Query) (absolutePath string
7879
func (s *Service) getStringMap(path string) map[string]string {
7980
tree, err := s.src.GetRecursive(path)
8081
if err != nil {
81-
return nil
82+
log.WithError(err).
83+
WithField("path", path).
84+
Warning("getStringMap from configuration backend failed, possibly rate limited")
85+
return map[string]string{}
8286
}
8387
if tree.Type() == cfgbackend.IT_Map {
8488
responseMap := tree.Map()
@@ -109,7 +113,7 @@ func (s *Service) getStringMap(path string) map[string]string {
109113
}
110114
return theMap
111115
}
112-
return nil
116+
return map[string]string{}
113117
}
114118

115119
func (s *Service) resolveComponentQuery(query *componentcfg.Query) (resolved *componentcfg.Query, err error) {

0 commit comments

Comments
 (0)