Handle when pluginCatalog.Get returns (nil,nil) during cred backend creation (#17204)

This commit is contained in:
Nick Cabatoff 2022-09-20 08:57:08 -04:00 committed by GitHub
parent c7f4d79684
commit d8101f82ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

3
changelog/17204.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
core: Fix panic when the plugin catalog returns neither a plugin nor an error.
```

View File

@ -797,7 +797,8 @@ func (c *Core) setupCredentials(ctx context.Context) error {
backend, err = c.newCredentialBackend(ctx, entry, sysView, view)
if err != nil {
c.logger.Error("failed to create credential entry", "path", entry.Path, "error", err)
if plug, plugerr := c.pluginCatalog.Get(ctx, entry.Type, consts.PluginTypeCredential, ""); plugerr == nil && !plug.Builtin {
plug, plugerr := c.pluginCatalog.Get(ctx, entry.Type, consts.PluginTypeCredential, "")
if plugerr == nil && plug != nil && !plug.Builtin {
// If we encounter an error instantiating the backend due to an error,
// skip backend initialization but register the entry to the mount table
// to preserve storage and path.