Skip to content

Commit

Permalink
[upgrade] Handle APM being disabled, fixes #30301 (#30308) (#30408)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdover committed Feb 7, 2019
1 parent 773f631 commit f629dd2
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/server/kbn_server.d.ts
Expand Up @@ -35,7 +35,7 @@ declare module 'hapi' {
elasticsearch: ElasticsearchPlugin;
kibana: any;
spaces: any;
apm_oss: ApmOssPlugin;
apm_oss?: ApmOssPlugin;
// add new plugin types here
}

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/upgrade_assistant/index.ts
Expand Up @@ -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: {
Expand Down
Expand Up @@ -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,
Expand Down
Expand Up @@ -6,6 +6,7 @@

import Boom from 'boom';
import { Legacy } from 'kibana';
import { get } from 'lodash';

import { getUpgradeAssistantStatus } from '../lib/es_migration_apis';

Expand All @@ -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,
Expand Down
Expand Up @@ -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';
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit f629dd2

Please sign in to comment.