diff options
author | Joram Wilander <jwawilander@gmail.com> | 2018-09-21 11:07:32 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2018-09-21 08:07:32 -0700 |
commit | d764b26b52f8938e50429f03a664a849e23b30bc (patch) | |
tree | 990d85c92cd9274122516b6c459ff766bcdbc807 /plugin/environment.go | |
parent | a08df883b4ddb514d53b518f41431ce7efb50d8f (diff) | |
download | chat-d764b26b52f8938e50429f03a664a849e23b30bc.tar.gz chat-d764b26b52f8938e50429f03a664a849e23b30bc.tar.bz2 chat-d764b26b52f8938e50429f03a664a849e23b30bc.zip |
Fail plugin activation if no web app and server component (#9438)
Diffstat (limited to 'plugin/environment.go')
-rw-r--r-- | plugin/environment.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/plugin/environment.go b/plugin/environment.go index 55543e239..94e5f2646 100644 --- a/plugin/environment.go +++ b/plugin/environment.go @@ -166,7 +166,9 @@ func (env *Environment) Activate(id string) (manifest *model.Manifest, activated env.activePlugins.Store(pluginInfo.Manifest.Id, activePlugin) }() - if pluginInfo.Manifest.Webapp != nil { + componentActivated := false + + if pluginInfo.Manifest.HasWebapp() { bundlePath := filepath.Clean(pluginInfo.Manifest.Webapp.BundlePath) if bundlePath == "" || bundlePath[0] == '.' { return nil, false, fmt.Errorf("invalid webapp bundle path") @@ -199,6 +201,8 @@ func (env *Environment) Activate(id string) (manifest *model.Manifest, activated ); err != nil { return nil, false, errors.Wrapf(err, "unable to rename webapp bundle: %v", id) } + + componentActivated = true } if pluginInfo.Manifest.HasServer() { @@ -207,6 +211,12 @@ func (env *Environment) Activate(id string) (manifest *model.Manifest, activated return nil, false, errors.Wrapf(err, "unable to start plugin: %v", id) } activePlugin.supervisor = supervisor + + componentActivated = true + } + + if !componentActivated { + return nil, false, fmt.Errorf("unable to start plugin: must at least have a web app or server component") } return pluginInfo.Manifest, true, nil |