diff --git a/command/server.go b/command/server.go index b1cc61d8e..705aa3a32 100644 --- a/command/server.go +++ b/command/server.go @@ -967,7 +967,7 @@ CLUSTER_SYNTHESIS_COMPLETE: return 1 } - var plugins []string + var plugins, pluginsNotLoaded []string if c.flagDevPluginDir != "" && c.flagDevPluginInit { f, err := os.Open(c.flagDevPluginDir) @@ -986,8 +986,12 @@ CLUSTER_SYNTHESIS_COMPLETE: for _, name := range list { path := filepath.Join(f.Name(), name) if err := c.addPlugin(path, init.RootToken, core); err != nil { - c.UI.Error(fmt.Sprintf("Error enabling plugin %s: %s", name, err)) - return 1 + if !errwrap.Contains(err, vault.ErrPluginBadType.Error()) { + c.UI.Error(fmt.Sprintf("Error enabling plugin %s: %s", name, err)) + return 1 + } + pluginsNotLoaded = append(pluginsNotLoaded, name) + continue } plugins = append(plugins, name) } @@ -1044,6 +1048,15 @@ CLUSTER_SYNTHESIS_COMPLETE: } } + if len(pluginsNotLoaded) > 0 { + c.UI.Warn("") + c.UI.Warn(wrapAtLength( + "The following dev plugins FAILED to be registered in the catalog due to unknown type:")) + for _, p := range pluginsNotLoaded { + c.UI.Warn(fmt.Sprintf(" - %s", p)) + } + } + c.UI.Warn("") c.UI.Warn(wrapAtLength( "Development mode should NOT be used in production installations!")) diff --git a/vault/plugin_catalog.go b/vault/plugin_catalog.go index ad5fc2b4d..b81b024aa 100644 --- a/vault/plugin_catalog.go +++ b/vault/plugin_catalog.go @@ -26,6 +26,7 @@ var ( pluginCatalogPath = "core/plugin-catalog/" ErrDirectoryNotConfigured = errors.New("could not set plugin, plugin directory is not configured") ErrPluginNotFound = errors.New("plugin not found in the catalog") + ErrPluginBadType = errors.New("unable to determine plugin type") ) // PluginCatalog keeps a record of plugins known to vault. External plugins need @@ -270,7 +271,7 @@ func (c *PluginCatalog) setInternal(ctx context.Context, name string, pluginType pluginType, err = c.getPluginTypeFromUnknown(ctx, entryTmp) if err != nil || pluginType == consts.PluginTypeUnknown { - return errors.New("unable to determine plugin type") + return ErrPluginBadType } }