mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Replace default warning by an info message (#145086)
Customers upgrading to 8.6 should not have warning messages for a new feature that they have not enabled. This PR changes the default behaviour, logging an `info` message (instead of a `warn`) when the default connector configuration is missing for the `'notifications'` plugin.
This commit is contained in:
parent
f1117c8959
commit
261231f8c8
2 changed files with 16 additions and 9 deletions
|
@ -79,15 +79,16 @@ describe('ConnectorsEmailServiceProvider', () => {
|
|||
expect(serviceProvider['setupSuccessful']).toEqual(false);
|
||||
});
|
||||
|
||||
it('should log a warning if no default email connector has been defined', () => {
|
||||
it('should log an info message if no default email connector has been defined', () => {
|
||||
const serviceProvider = new EmailServiceProvider(missingConnectorConfig, logger);
|
||||
serviceProvider.setup({
|
||||
actions: actionsSetup,
|
||||
licensing: licensingMock.createSetup(),
|
||||
});
|
||||
|
||||
expect(logger.warn).toHaveBeenCalledTimes(1);
|
||||
expect(logger.warn).toHaveBeenCalledWith(
|
||||
expect(logger.warn).not.toHaveBeenCalled();
|
||||
expect(logger.info).toHaveBeenCalledTimes(1);
|
||||
expect(logger.info).toHaveBeenCalledWith(
|
||||
`Email Service Error: Email connector not specified.`
|
||||
);
|
||||
// eslint-disable-next-line dot-notation
|
||||
|
|
|
@ -41,16 +41,18 @@ export class EmailServiceProvider
|
|||
const { actions, licensing } = plugins;
|
||||
|
||||
if (!actions || !licensing) {
|
||||
return this._registerServiceError(`Error: 'actions' and 'licensing' plugins are required.`);
|
||||
return this._registerInitializationError(
|
||||
`Error: 'actions' and 'licensing' plugins are required.`
|
||||
);
|
||||
}
|
||||
|
||||
const emailConnector = this.config.connectors?.default?.email;
|
||||
if (!emailConnector) {
|
||||
return this._registerServiceError('Error: Email connector not specified.');
|
||||
return this._registerInitializationError('Error: Email connector not specified.', 'info');
|
||||
}
|
||||
|
||||
if (!actions.isPreconfiguredConnector(emailConnector)) {
|
||||
return this._registerServiceError(
|
||||
return this._registerInitializationError(
|
||||
`Error: Unexisting email connector '${emailConnector}' specified.`
|
||||
);
|
||||
}
|
||||
|
@ -75,7 +77,7 @@ export class EmailServiceProvider
|
|||
this.logger
|
||||
);
|
||||
} catch (err) {
|
||||
this._registerServiceError(err);
|
||||
this._registerInitializationError(err);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,9 +92,13 @@ export class EmailServiceProvider
|
|||
};
|
||||
}
|
||||
|
||||
private _registerServiceError(error: string) {
|
||||
private _registerInitializationError(error: string, level: 'info' | 'warn' = 'warn') {
|
||||
const message = `Email Service ${error}`;
|
||||
this.setupError = message;
|
||||
this.logger.warn(message);
|
||||
if (level === 'info') {
|
||||
this.logger.info(message);
|
||||
} else {
|
||||
this.logger.warn(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue