Skip to content

Commit 5ff2eec

Browse files
committed
required manualSteps everywhere
1 parent cb36b15 commit 5ff2eec

File tree

19 files changed

+298
-58
lines changed

19 files changed

+298
-58
lines changed

packages/kbn-config/src/config_service.test.ts

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,14 @@ test('logs deprecation warning during validation', async () => {
418418
const configService = new ConfigService(rawConfig, defaultEnv, logger);
419419
mockApplyDeprecations.mockImplementationOnce((config, deprecations, createAddDeprecation) => {
420420
const addDeprecation = createAddDeprecation!('');
421-
addDeprecation({ message: 'some deprecation message' });
422-
addDeprecation({ message: 'another deprecation message' });
421+
addDeprecation({
422+
message: 'some deprecation message',
423+
correctiveActions: { manualSteps: ['do X'] },
424+
});
425+
addDeprecation({
426+
message: 'another deprecation message',
427+
correctiveActions: { manualSteps: ['do Y'] },
428+
});
423429
return { config, changedPaths: mockedChangedPaths };
424430
});
425431

@@ -444,13 +450,24 @@ test('does not log warnings for silent deprecations during validation', async ()
444450
mockApplyDeprecations
445451
.mockImplementationOnce((config, deprecations, createAddDeprecation) => {
446452
const addDeprecation = createAddDeprecation!('');
447-
addDeprecation({ message: 'some deprecation message', silent: true });
448-
addDeprecation({ message: 'another deprecation message' });
453+
addDeprecation({
454+
message: 'some deprecation message',
455+
correctiveActions: { manualSteps: ['do X'] },
456+
silent: true,
457+
});
458+
addDeprecation({
459+
message: 'another deprecation message',
460+
correctiveActions: { manualSteps: ['do Y'] },
461+
});
449462
return { config, changedPaths: mockedChangedPaths };
450463
})
451464
.mockImplementationOnce((config, deprecations, createAddDeprecation) => {
452465
const addDeprecation = createAddDeprecation!('');
453-
addDeprecation({ message: 'I am silent', silent: true });
466+
addDeprecation({
467+
message: 'I am silent',
468+
silent: true,
469+
correctiveActions: { manualSteps: ['do Z'] },
470+
});
454471
return { config, changedPaths: mockedChangedPaths };
455472
});
456473

@@ -519,7 +536,11 @@ describe('getHandledDeprecatedConfigs', () => {
519536
mockApplyDeprecations.mockImplementationOnce((config, deprecations, createAddDeprecation) => {
520537
deprecations.forEach((deprecation) => {
521538
const addDeprecation = createAddDeprecation!(deprecation.path);
522-
addDeprecation({ message: `some deprecation message`, documentationUrl: 'some-url' });
539+
addDeprecation({
540+
message: `some deprecation message`,
541+
documentationUrl: 'some-url',
542+
correctiveActions: { manualSteps: ['do X'] },
543+
});
523544
});
524545
return { config, changedPaths: mockedChangedPaths };
525546
});
@@ -532,6 +553,11 @@ describe('getHandledDeprecatedConfigs', () => {
532553
"base",
533554
Array [
534555
Object {
556+
"correctiveActions": Object {
557+
"manualSteps": Array [
558+
"do X",
559+
],
560+
},
535561
"documentationUrl": "some-url",
536562
"message": "some deprecation message",
537563
},

packages/kbn-config/src/deprecation/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export interface DeprecatedConfigDetails {
2525
silent?: boolean;
2626
/* (optional) link to the documentation for more details on the deprecation. */
2727
documentationUrl?: string;
28-
/* (optional) corrective action needed to fix this deprecation. */
29-
correctiveActions?: {
28+
/* corrective action needed to fix this deprecation. */
29+
correctiveActions: {
3030
/**
3131
* Specify a list of manual steps our users need to follow
3232
* to fix the deprecation before upgrade.

src/core/server/config/deprecation/core_deprecations.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('core deprecations', () => {
2424
const { messages } = applyCoreDeprecations();
2525
expect(messages).toMatchInlineSnapshot(`
2626
Array [
27-
"Environment variable CONFIG_PATH is deprecated. It has been replaced with KBN_PATH_CONF pointing to a config folder",
27+
"Environment variable \\"CONFIG_PATH\\" is deprecated. It has been replaced with \\"KBN_PATH_CONF\\" pointing to a config folder",
2828
]
2929
`);
3030
});
@@ -405,7 +405,7 @@ describe('core deprecations', () => {
405405
});
406406
expect(messages).toMatchInlineSnapshot(`
407407
Array [
408-
"\\"logging.events.log\\" has been deprecated and will be removed in 8.0. Moving forward, log levels can be customized on a per-logger basis using the new logging configuration. ",
408+
"\\"logging.events.log\\" has been deprecated and will be removed in 8.0. Moving forward, log levels can be customized on a per-logger basis using the new logging configuration.",
409409
]
410410
`);
411411
});
@@ -418,7 +418,7 @@ describe('core deprecations', () => {
418418
});
419419
expect(messages).toMatchInlineSnapshot(`
420420
Array [
421-
"\\"logging.events.error\\" has been deprecated and will be removed in 8.0. Moving forward, you can use \\"logging.root.level: error\\" in your logging configuration. ",
421+
"\\"logging.events.error\\" has been deprecated and will be removed in 8.0. Moving forward, you can use \\"logging.root.level: error\\" in your logging configuration.",
422422
]
423423
`);
424424
});

src/core/server/config/deprecation/core_deprecations.ts

Lines changed: 113 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ import { ConfigDeprecationProvider, ConfigDeprecation } from '@kbn/config';
1111
const configPathDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecation) => {
1212
if (process.env?.CONFIG_PATH) {
1313
addDeprecation({
14-
message: `Environment variable CONFIG_PATH is deprecated. It has been replaced with KBN_PATH_CONF pointing to a config folder`,
14+
message: `Environment variable "CONFIG_PATH" is deprecated. It has been replaced with "KBN_PATH_CONF" pointing to a config folder`,
15+
correctiveActions: {
16+
manualSteps: ['Use "KBN_PATH_CONF" instead of "CONFIG_PATH" to point to a config folder.'],
17+
},
1518
});
1619
}
1720
};
@@ -20,6 +23,11 @@ const dataPathDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecati
2023
if (process.env?.DATA_PATH) {
2124
addDeprecation({
2225
message: `Environment variable "DATA_PATH" will be removed. It has been replaced with kibana.yml setting "path.data"`,
26+
correctiveActions: {
27+
manualSteps: [
28+
`Set 'path.data' in the config file or CLI flag with the value of the environment variable "DATA_PATH".`,
29+
],
30+
},
2331
});
2432
}
2533
};
@@ -32,6 +40,12 @@ const rewriteBasePathDeprecation: ConfigDeprecation = (settings, fromPath, addDe
3240
'will expect that all requests start with server.basePath rather than expecting you to rewrite ' +
3341
'the requests in your reverse proxy. Set server.rewriteBasePath to false to preserve the ' +
3442
'current behavior and silence this warning.',
43+
correctiveActions: {
44+
manualSteps: [
45+
`Set 'server.rewriteBasePath' in the config file, CLI flag, or environment variable (in Docker only).`,
46+
`Set to false to preserve the current behavior and silence this warning.`,
47+
],
48+
},
3549
});
3650
}
3751
};
@@ -41,6 +55,11 @@ const rewriteCorsSettings: ConfigDeprecation = (settings, fromPath, addDeprecati
4155
if (typeof corsSettings === 'boolean') {
4256
addDeprecation({
4357
message: '"server.cors" is deprecated and has been replaced by "server.cors.enabled"',
58+
correctiveActions: {
59+
manualSteps: [
60+
`Replace "server.cors: ${corsSettings}" with "server.cors.enabled: ${corsSettings}"`,
61+
],
62+
},
4463
});
4564

4665
return {
@@ -72,6 +91,9 @@ const cspRulesDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecati
7291
if (sourceList.find((source) => source.includes(NONCE_STRING))) {
7392
addDeprecation({
7493
message: `csp.rules no longer supports the {nonce} syntax. Replacing with 'self' in ${policy}`,
94+
correctiveActions: {
95+
manualSteps: [`Replace {nonce} syntax with 'self' in ${policy}`],
96+
},
7597
});
7698
sourceList = sourceList.filter((source) => !source.includes(NONCE_STRING));
7799

@@ -87,6 +109,9 @@ const cspRulesDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecati
87109
) {
88110
addDeprecation({
89111
message: `csp.rules must contain the 'self' source. Automatically adding to ${policy}.`,
112+
correctiveActions: {
113+
manualSteps: [`Add 'self' source to ${policy}.`],
114+
},
90115
});
91116
sourceList.push(SELF_STRING);
92117
}
@@ -111,6 +136,12 @@ const mapManifestServiceUrlDeprecation: ConfigDeprecation = (
111136
'of the Elastic Maps Service settings. These settings have moved to the "map.emsTileApiUrl" and ' +
112137
'"map.emsFileApiUrl" settings instead. These settings are for development use only and should not be ' +
113138
'modified for use in production environments.',
139+
correctiveActions: {
140+
manualSteps: [
141+
`Use "map.emsTileApiUrl" and "map.emsFileApiUrl" config instead of "map.manifestServiceUrl".`,
142+
`These settings are for development use only and should not be modified for use in production environments.`,
143+
],
144+
},
114145
});
115146
}
116147
};
@@ -125,12 +156,28 @@ const opsLoggingEventDeprecation: ConfigDeprecation = (settings, fromPath, addDe
125156
'in 8.0. To access ops data moving forward, please enable debug logs for the ' +
126157
'"metrics.ops" context in your logging configuration. For more details, see ' +
127158
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx',
159+
correctiveActions: {
160+
manualSteps: [
161+
`Remove "logging.events.ops" from your kibana settings.`,
162+
`Enable debug logs for the "metrics.ops" context in your logging configuration`,
163+
],
164+
},
128165
});
129166
}
130167
};
131168

132169
const requestLoggingEventDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecation) => {
133170
if (settings.logging?.events?.request || settings.logging?.events?.response) {
171+
const removeConfigsSteps = [];
172+
173+
if (settings.logging?.events?.request) {
174+
removeConfigsSteps.push(`Remove "logging.events.request" from your kibana configs.`);
175+
}
176+
177+
if (settings.logging?.events?.response) {
178+
removeConfigsSteps.push(`Remove "logging.events.response" from your kibana configs.`);
179+
}
180+
134181
addDeprecation({
135182
documentationUrl:
136183
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx#loggingevents',
@@ -139,6 +186,12 @@ const requestLoggingEventDeprecation: ConfigDeprecation = (settings, fromPath, a
139186
'in 8.0. To access request and/or response data moving forward, please enable debug logs for the ' +
140187
'"http.server.response" context in your logging configuration. For more details, see ' +
141188
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx',
189+
correctiveActions: {
190+
manualSteps: [
191+
...removeConfigsSteps,
192+
`enable debug logs for the "http.server.response" context in your logging configuration.`,
193+
],
194+
},
142195
});
143196
}
144197
};
@@ -153,6 +206,12 @@ const timezoneLoggingDeprecation: ConfigDeprecation = (settings, fromPath, addDe
153206
'in 8.0. To set the timezone moving forward, please add a timezone date modifier to the log pattern ' +
154207
'in your logging configuration. For more details, see ' +
155208
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx',
209+
correctiveActions: {
210+
manualSteps: [
211+
`Remove "logging.timezone" from your kibana configs.`,
212+
`To set the timezone add a timezone date modifier to the log pattern in your logging configuration.`,
213+
],
214+
},
156215
});
157216
}
158217
};
@@ -167,6 +226,12 @@ const destLoggingDeprecation: ConfigDeprecation = (settings, fromPath, addDeprec
167226
'in 8.0. To set the destination moving forward, you can use the "console" appender ' +
168227
'in your logging configuration or define a custom one. For more details, see ' +
169228
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx',
229+
correctiveActions: {
230+
manualSteps: [
231+
`Remove "logging.dest" from your kibana configs.`,
232+
`To set the destination use the "console" appender in your logging configuration or define a custom one.`,
233+
],
234+
},
170235
});
171236
}
172237
};
@@ -179,6 +244,12 @@ const quietLoggingDeprecation: ConfigDeprecation = (settings, fromPath, addDepre
179244
message:
180245
'"logging.quiet" has been deprecated and will be removed ' +
181246
'in 8.0. Moving forward, you can use "logging.root.level:error" in your logging configuration. ',
247+
correctiveActions: {
248+
manualSteps: [
249+
`Remove "logging.quiet" from your kibana configs.`,
250+
`Use "logging.root.level:error" in your logging configuration.`,
251+
],
252+
},
182253
});
183254
}
184255
};
@@ -191,6 +262,12 @@ const silentLoggingDeprecation: ConfigDeprecation = (settings, fromPath, addDepr
191262
message:
192263
'"logging.silent" has been deprecated and will be removed ' +
193264
'in 8.0. Moving forward, you can use "logging.root.level:off" in your logging configuration. ',
265+
correctiveActions: {
266+
manualSteps: [
267+
`Remove "logging.silent" from your kibana configs.`,
268+
`Use "logging.root.level:off" in your logging configuration.`,
269+
],
270+
},
194271
});
195272
}
196273
};
@@ -203,6 +280,12 @@ const verboseLoggingDeprecation: ConfigDeprecation = (settings, fromPath, addDep
203280
message:
204281
'"logging.verbose" has been deprecated and will be removed ' +
205282
'in 8.0. Moving forward, you can use "logging.root.level:all" in your logging configuration. ',
283+
correctiveActions: {
284+
manualSteps: [
285+
`Remove "logging.verbose" from your kibana configs.`,
286+
`Use "logging.root.level:all" in your logging configuration.`,
287+
],
288+
},
206289
});
207290
}
208291
};
@@ -223,6 +306,12 @@ const jsonLoggingDeprecation: ConfigDeprecation = (settings, fromPath, addDeprec
223306
'There is currently no default layout for custom appenders and each one must be declared explicitly. ' +
224307
'For more details, see ' +
225308
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx',
309+
correctiveActions: {
310+
manualSteps: [
311+
`Remove "logging.json" from your kibana configs.`,
312+
`Configure the "appender.layout" property for every custom appender in your logging configuration.`,
313+
],
314+
},
226315
});
227316
}
228317
};
@@ -237,6 +326,12 @@ const logRotateDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecat
237326
'Moving forward, you can enable log rotation using the "rolling-file" appender for a logger ' +
238327
'in your logging configuration. For more details, see ' +
239328
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx#rolling-file-appender',
329+
correctiveActions: {
330+
manualSteps: [
331+
`Remove "logging.rotate" from your kibana configs.`,
332+
`Enable log rotation using the "rolling-file" appender for a logger in your logging configuration.`,
333+
],
334+
},
240335
});
241336
}
242337
};
@@ -248,7 +343,13 @@ const logEventsLogDeprecation: ConfigDeprecation = (settings, fromPath, addDepre
248343
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx#loggingevents',
249344
message:
250345
'"logging.events.log" has been deprecated and will be removed ' +
251-
'in 8.0. Moving forward, log levels can be customized on a per-logger basis using the new logging configuration. ',
346+
'in 8.0. Moving forward, log levels can be customized on a per-logger basis using the new logging configuration.',
347+
correctiveActions: {
348+
manualSteps: [
349+
`Remove "logging.events.log" from your kibana configs.`,
350+
`Customize log levels can be per-logger using the new logging configuration.`,
351+
],
352+
},
252353
});
253354
}
254355
};
@@ -260,7 +361,13 @@ const logEventsErrorDeprecation: ConfigDeprecation = (settings, fromPath, addDep
260361
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx#loggingevents',
261362
message:
262363
'"logging.events.error" has been deprecated and will be removed ' +
263-
'in 8.0. Moving forward, you can use "logging.root.level: error" in your logging configuration. ',
364+
'in 8.0. Moving forward, you can use "logging.root.level: error" in your logging configuration.',
365+
correctiveActions: {
366+
manualSteps: [
367+
`Remove "logging.events.error" from your kibana configs.`,
368+
`Use "logging.root.level: error" in your logging configuration.`,
369+
],
370+
},
264371
});
265372
}
266373
};
@@ -271,6 +378,9 @@ const logFilterDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecat
271378
documentationUrl:
272379
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx#loggingfilter',
273380
message: '"logging.filter" has been deprecated and will be removed in 8.0.',
381+
correctiveActions: {
382+
manualSteps: [`Remove "logging.filter" from your kibana configs.`],
383+
},
274384
});
275385
}
276386
};

src/core/server/deprecations/deprecations_service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export class DeprecationsService implements CoreService<InternalDeprecationsServ
154154
level: 'critical',
155155
deprecationType: 'config',
156156
message,
157-
correctiveActions: correctiveActions ?? {},
157+
correctiveActions,
158158
documentationUrl,
159159
};
160160
});

src/core/server/deprecations/types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ export interface DeprecationsDetails {
5555
};
5656
};
5757
/**
58-
* (optional) If this deprecation cannot be automtically fixed
59-
* via an API corrective action. Specify a list of manual steps
60-
* users need to follow to fix the deprecation before upgrade.
58+
* Specify a list of manual steps users need to follow to
59+
* fix the deprecation before upgrade. Required even if an API
60+
* corrective action is set in case the API fails.
6161
*/
62-
manualSteps?: string[];
62+
manualSteps: string[];
6363
};
6464
}
6565

0 commit comments

Comments
 (0)