Skip to content

Commit

Permalink
Merge pull request elastic#7953 from ppisljar/fix-4725
Browse files Browse the repository at this point in the history
fixes elastic#4725 - plugins without init function shouldn't show statuses

Former-commit-id: adfcf06
  • Loading branch information
ppisljar authored Aug 10, 2016
2 parents 5945a71 + 1cbdc24 commit 0ecea60
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/server/plugins/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,13 @@ module.exports = class Plugin {
server.exposeStaticDir(`/plugins/${id}/{path*}`, this.publicDir);
}

this.status = kbnServer.status.createForPlugin(this);
server.expose('status', this.status);
// Many of the plugins are simply adding static assets to the server and we don't need
// to track their "status". Since plugins must have an init() function to even set its status
// we shouldn't even create a status unless the plugin can use it.
if (this.externalInit !== _.noop) {
this.status = kbnServer.status.createForPlugin(this);
server.expose('status', this.status);
}

return await attempt(this.externalInit, [server, options], this);
};
Expand All @@ -148,7 +153,7 @@ module.exports = class Plugin {

// Only change the plugin status to green if the
// intial status has not been changed
if (this.status.state === 'uninitialized') {
if (this.status && this.status.state === 'uninitialized') {
this.status.green('Ready');
}
}
Expand Down

0 comments on commit 0ecea60

Please sign in to comment.