From 1916ab4d436378b887c286af300964fe3d33981b Mon Sep 17 00:00:00 2001 From: Chris Roberson Date: Wed, 6 Oct 2021 15:24:16 -0400 Subject: [PATCH] [Alerting] Track deprecated configs (#113015) (#114147) * Track deprecated configs * PR feedback * Be more careful * Add test back in * Fix types Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> # Conflicts: # x-pack/plugins/actions/server/index.test.ts --- x-pack/plugins/actions/server/index.ts | 28 ++++++++++++++++++--- x-pack/plugins/task_manager/server/index.ts | 3 +++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/actions/server/index.ts b/x-pack/plugins/actions/server/index.ts index bf59a1a11687d..26f7da073223d 100644 --- a/x-pack/plugins/actions/server/index.ts +++ b/x-pack/plugins/actions/server/index.ts @@ -64,7 +64,8 @@ export const config: PluginConfigDescriptor = { if ( customHostSettings.find( (customHostSchema: CustomHostSettings) => - !!customHostSchema.ssl && !!customHostSchema.ssl.rejectUnauthorized + customHostSchema.hasOwnProperty('ssl') && + customHostSchema.ssl?.hasOwnProperty('rejectUnauthorized') ) ) { addDeprecation({ @@ -82,11 +83,18 @@ export const config: PluginConfigDescriptor = { ], }, }); + return { + unset: [ + { + path: `xpack.actions.customHostSettings.ssl.rejectUnauthorized`, + }, + ], + }; } }, (settings, fromPath, addDeprecation) => { const actions = get(settings, fromPath); - if (!!actions?.rejectUnauthorized) { + if (actions?.hasOwnProperty('rejectUnauthorized')) { addDeprecation({ message: `"xpack.actions.rejectUnauthorized" is deprecated. Use "xpack.actions.verificationMode" instead, ` + @@ -101,11 +109,18 @@ export const config: PluginConfigDescriptor = { ], }, }); + return { + unset: [ + { + path: `xpack.actions.rejectUnauthorized`, + }, + ], + }; } }, (settings, fromPath, addDeprecation) => { const actions = get(settings, fromPath); - if (!!actions?.proxyRejectUnauthorizedCertificates) { + if (actions?.hasOwnProperty('proxyRejectUnauthorizedCertificates')) { addDeprecation({ message: `"xpack.actions.proxyRejectUnauthorizedCertificates" is deprecated. Use "xpack.actions.proxyVerificationMode" instead, ` + @@ -120,6 +135,13 @@ export const config: PluginConfigDescriptor = { ], }, }); + return { + unset: [ + { + path: `xpack.actions.proxyRejectUnauthorizedCertificates`, + }, + ], + }; } }, (settings, fromPath, addDeprecation) => { diff --git a/x-pack/plugins/task_manager/server/index.ts b/x-pack/plugins/task_manager/server/index.ts index 368b5a3441778..84bee044c4de9 100644 --- a/x-pack/plugins/task_manager/server/index.ts +++ b/x-pack/plugins/task_manager/server/index.ts @@ -41,6 +41,9 @@ export type { export const config: PluginConfigDescriptor = { schema: configSchema, + exposeToUsage: { + max_workers: true, + }, deprecations: () => [ (settings, fromPath, addDeprecation) => { const taskManager = get(settings, fromPath);