Plugins: Fix Azure token provider cache panic and auth param nil value (#34252)

* More tests for token cache

* Safeguarding from panic and concurrency fixes

* Update Azure dependencies

* Fix interpolation of empty plugin data
This commit is contained in:
Sergey Kostrukov
2021-05-18 06:36:58 -07:00
committed by GitHub
parent 63b2dd06a5
commit c1b8a10f41
8 changed files with 363 additions and 86 deletions

View File

@ -14,7 +14,16 @@ import (
// interpolateString accepts template data and return a string with substitutions
func interpolateString(text string, data templateData) (string, error) {
t, err := template.New("content").Parse(text)
extraFuncs := map[string]interface{}{
"orEmpty": func(v interface{}) interface{} {
if v == nil {
return ""
}
return v
},
}
t, err := template.New("content").Funcs(extraFuncs).Parse(text)
if err != nil {
return "", fmt.Errorf("could not parse template %s", text)
}