-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--------- **Commit 1:** fixes plugin path in .gitignore * Original sha: f74eb9b * Authored by Jim Unger <bigfunger@gmail.com> on 2016-09-14T18:40:21Z **Commit 2:** Moves version from plugin installer to utils * Original sha: ae492ff * Authored by Jim Unger <bigfunger@gmail.com> on 2016-09-14T18:41:19Z **Commit 3:** Adds plugin version check to kibana startup * Original sha: 83d0821 * Authored by Jim Unger <bigfunger@gmail.com> on 2016-09-14T18:41:40Z **Commit 4:** Changes plugin version to 'kibana' in text fixture * Original sha: 922c04a * Authored by Jim Unger <bigfunger@gmail.com> on 2016-09-14T19:07:09Z **Commit 5:** Merge branch 'master' into check-plugin-version-on-startup * Original sha: 5da33ad * Authored by Jim Unger <bigfunger@gmail.com> on 2016-09-15T14:45:01Z **Commit 6:** review changes to check_version * Original sha: 2802410 * Authored by Jim Unger <bigfunger@gmail.com> on 2016-09-15T16:53:28Z **Commit 7:** reworked logic to remove config when deleting a plugin from plugin_collection * Original sha: 2f52be6 * Authored by Jim Unger <bigfunger@gmail.com> on 2016-09-15T20:11:43Z **Commit 8:** Adds a kibanaVersion property to the Plugin class * Original sha: e920bca * Authored by Jim Unger <bigfunger@gmail.com> on 2016-09-15T21:04:41Z **Commit 9:** move enabled check into it's own mixin, and cleaned up how you disable a plugin * Original sha: 049c029 * Authored by Jim Unger <bigfunger@gmail.com> on 2016-09-16T17:22:47Z
- Loading branch information
1 parent
c76b619
commit 246b069
Showing
11 changed files
with
94 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ target | |
/esvm | ||
.htpasswd | ||
.eslintcache | ||
plugins | ||
/plugins/ | ||
data | ||
disabledPlugins | ||
webpackstats.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import toPath from 'lodash/internal/toPath'; | ||
|
||
export default async function (kbnServer, server, config) { | ||
const { plugins } = kbnServer; | ||
|
||
for (let plugin of plugins) { | ||
const enabledInConfig = config.get([...toPath(plugin.configPrefix), 'enabled']); | ||
|
||
if (!enabledInConfig) { | ||
plugins.disable(plugin); | ||
} | ||
} | ||
|
||
return; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { cleanVersion, versionSatisfies } from '../../utils/version'; | ||
import { get } from 'lodash'; | ||
|
||
function compatibleWithKibana(kbnServer, plugin) { | ||
//core plugins have a version of 'kibana' and are always compatible | ||
if (plugin.kibanaVersion === 'kibana') return true; | ||
|
||
const pluginKibanaVersion = cleanVersion(plugin.kibanaVersion); | ||
const kibanaVersion = cleanVersion(kbnServer.version); | ||
|
||
return versionSatisfies(pluginKibanaVersion, kibanaVersion); | ||
} | ||
|
||
export default async function (kbnServer, server, config) { | ||
//because a plugin pack can contain more than one actual plugin, (for example x-pack) | ||
//we make sure that the warning messages are unique | ||
const warningMessages = new Set(); | ||
const plugins = kbnServer.plugins; | ||
|
||
for (let plugin of plugins) { | ||
const version = plugin.kibanaVersion; | ||
const name = get(plugin, 'pkg.name'); | ||
|
||
if (!compatibleWithKibana(kbnServer, plugin)) { | ||
const message = `Plugin "${name}" was disabled because it expected Kibana version "${version}", and found "${kbnServer.version}".`; | ||
warningMessages.add(message); | ||
plugins.disable(plugin); | ||
} | ||
} | ||
|
||
for (let message of warningMessages) { | ||
server.log(['warning'], message); | ||
} | ||
|
||
return; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"name": "plugin_async_foo", | ||
"version": "0.0.0" | ||
"version": "kibana" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"name": "plugin_bar", | ||
"version": "0.0.0" | ||
"version": "kibana" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"name": "plugin_foo", | ||
"version": "0.0.0" | ||
"version": "kibana" | ||
} |
File renamed without changes.