[upgrade] Handle APM being disabled, fixes #30301 (#30308) (#30408)

This commit is contained in:
Josh Dover 2019-02-07 14:55:21 -06:00 committed by GitHub
parent 773f631951
commit f629dd2c37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View file

@ -35,7 +35,7 @@ declare module 'hapi' {
elasticsearch: ElasticsearchPlugin;
kibana: any;
spaces: any;
apm_oss: ApmOssPlugin;
apm_oss?: ApmOssPlugin;
// add new plugin types here
}

View file

@ -13,7 +13,7 @@ export function upgradeAssistant(kibana: any) {
return new kibana.Plugin({
id: 'upgrade_assistant',
configPrefix: 'xpack.upgrade_assistant',
require: ['elasticsearch'],
require: ['elasticsearch', 'xpack_main'],
uiExports: {
managementSections: ['plugins/upgrade_assistant'],
savedObjectSchemas: {

View file

@ -55,8 +55,6 @@ export class ReindexWorker {
throw new Error(`More than one ReindexWorker cannot be created.`);
}
this.apmIndexPatterns = apmIndexPatterns;
this.reindexService = reindexServiceFactory(
this.callWithInternalUser,
this.xpackInfo,

View file

@ -6,6 +6,7 @@
import Boom from 'boom';
import { Legacy } from 'kibana';
import { get } from 'lodash';
import { getUpgradeAssistantStatus } from '../lib/es_migration_apis';
@ -18,7 +19,7 @@ export function registerClusterCheckupRoutes(server: Legacy.Server) {
method: 'GET',
async handler(request) {
try {
const apmIndexPatterns = server.plugins.apm_oss.indexPatterns;
const apmIndexPatterns = get(server, 'plugins.apm_oss.indexPatterns', []);
return await getUpgradeAssistantStatus(
callWithRequest,

View file

@ -6,6 +6,7 @@
import Boom from 'boom';
import { Server } from 'hapi';
import { get } from 'lodash';
import { CallCluster } from 'src/legacy/core_plugins/elasticsearch';
import { SavedObjectsClient } from 'src/server/saved_objects';
@ -41,7 +42,7 @@ export function registerReindexWorker(server: Server, credentialStore: Credentia
callWithInternalUser,
xpackInfo,
log,
server.plugins.apm_oss.indexPatterns
get(server, 'plugins.apm_oss.indexPatterns', [])
);
// Wait for ES connection before starting the polling loop.
@ -60,7 +61,7 @@ export function registerReindexIndicesRoutes(
) {
const { callWithRequest } = server.plugins.elasticsearch.getCluster('admin');
const xpackInfo = server.plugins.xpack_main.info;
const apmIndexPatterns = server.plugins.apm_oss.indexPatterns;
const apmIndexPatterns = get(server, 'plugins.apm_oss.indexPatterns', []);
const BASE_PATH = '/api/upgrade_assistant/reindex';
// Start reindex for an index