Skip to content

Commit

Permalink
Fix invalid version check logging for the legacy plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
mshustov committed Jan 14, 2020
1 parent aef8493 commit 5c8e658
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/core/server/legacy/legacy_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ export class LegacyService implements CoreService<LegacyServiceSetup> {
pluginExtendedConfig,
disabledPluginSpecs,
uiExports,
} = await findLegacyPluginSpecs(this.settings, this.coreContext.logger);
} = await findLegacyPluginSpecs(
this.settings,
this.coreContext.logger,
this.coreContext.env.packageInfo
);

this.legacyPlugins = {
pluginSpecs,
Expand Down
11 changes: 7 additions & 4 deletions src/core/server/legacy/plugins/find_legacy_plugin_specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
} from '../../../../legacy/plugin_discovery/find_plugin_specs.js';
import { LoggerFactory } from '../../logging';
import { collectUiExports as collectLegacyUiExports } from '../../../../legacy/ui/ui_exports/collect_ui_exports';
import { Config } from '../../config';
import { Config, PackageInfo } from '../../config';

export interface LegacyPluginPack {
getPath(): string;
Expand All @@ -38,7 +38,11 @@ export interface LegacyPluginSpec {
getConfigPrefix: () => string;
}

export async function findLegacyPluginSpecs(settings: unknown, loggerFactory: LoggerFactory) {
export async function findLegacyPluginSpecs(
settings: unknown,
loggerFactory: LoggerFactory,
packageInfo: PackageInfo
) {
const configToMutate: Config = defaultConfig(settings);
const {
pack$,
Expand Down Expand Up @@ -98,8 +102,7 @@ export async function findLegacyPluginSpecs(settings: unknown, loggerFactory: Lo
map(spec => {
const name = spec.getId();
const pluginVersion = spec.getExpectedKibanaVersion();
// @ts-ignore
const kibanaVersion = settings.pkg.version;
const kibanaVersion = packageInfo.version;
return `Plugin "${name}" was disabled because it expected Kibana version "${pluginVersion}", and found "${kibanaVersion}".`;
}),
distinct(),
Expand Down

0 comments on commit 5c8e658

Please sign in to comment.