Default to chromium and add deprecation warning for phantom. (#21505)
* Default to chromium and add deprecation warning for phantom. * use int, not float
This commit is contained in:
parent
4f26340c28
commit
ac03ffb42c
|
@ -76,8 +76,9 @@ Defaults to `3000` (3 seconds).
|
||||||
[[xpack-reporting-browser]]`xpack.reporting.capture.browser.type`::
|
[[xpack-reporting-browser]]`xpack.reporting.capture.browser.type`::
|
||||||
Specifies the browser to use to capture screenshots. Valid options are `phantom`
|
Specifies the browser to use to capture screenshots. Valid options are `phantom`
|
||||||
and `chromium`. When `chromium` is set, the settings specified in the <<reporting-chromium-settings, Chromium settings>>
|
and `chromium`. When `chromium` is set, the settings specified in the <<reporting-chromium-settings, Chromium settings>>
|
||||||
are respected.
|
are respected. This setting will be deprecated in 7.0, when Phantom support is removed.
|
||||||
Defaults to `phantom`.
|
Defaults to `chromium`.
|
||||||
|
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
[[reporting-chromium-settings]]
|
[[reporting-chromium-settings]]
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { config as appConfig } from './server/config/config';
|
||||||
import { checkLicenseFactory } from './server/lib/check_license';
|
import { checkLicenseFactory } from './server/lib/check_license';
|
||||||
import { validateConfig } from './server/lib/validate_config';
|
import { validateConfig } from './server/lib/validate_config';
|
||||||
import { exportTypesRegistryFactory } from './server/lib/export_types_registry';
|
import { exportTypesRegistryFactory } from './server/lib/export_types_registry';
|
||||||
import { createBrowserDriverFactory, getDefaultBrowser, getDefaultChromiumSandboxDisabled } from './server/browsers';
|
import { PHANTOM, createBrowserDriverFactory, getDefaultBrowser, getDefaultChromiumSandboxDisabled } from './server/browsers';
|
||||||
import { logConfiguration } from './log_configuration';
|
import { logConfiguration } from './log_configuration';
|
||||||
|
|
||||||
import { getReportingUsageCollector } from './server/usage';
|
import { getReportingUsageCollector } from './server/usage';
|
||||||
|
@ -87,7 +87,7 @@ export const reporting = (kibana) => {
|
||||||
settleTime: Joi.number().integer().default(1000), //deprecated
|
settleTime: Joi.number().integer().default(1000), //deprecated
|
||||||
concurrency: Joi.number().integer().default(appConfig.concurrency), //deprecated
|
concurrency: Joi.number().integer().default(appConfig.concurrency), //deprecated
|
||||||
browser: Joi.object({
|
browser: Joi.object({
|
||||||
type: Joi.any().valid('phantom', 'chromium').default(await getDefaultBrowser()),
|
type: Joi.any().valid('phantom', 'chromium').default(await getDefaultBrowser()), // TODO: remove support in 7.0
|
||||||
autoDownload: Joi.boolean().when('$dev', {
|
autoDownload: Joi.boolean().when('$dev', {
|
||||||
is: true,
|
is: true,
|
||||||
then: Joi.default(true),
|
then: Joi.default(true),
|
||||||
|
@ -145,6 +145,10 @@ export const reporting = (kibana) => {
|
||||||
validateConfig(config, message => server.log(['reporting', 'warning'], message));
|
validateConfig(config, message => server.log(['reporting', 'warning'], message));
|
||||||
logConfiguration(config, message => server.log(['reporting', 'debug'], message));
|
logConfiguration(config, message => server.log(['reporting', 'debug'], message));
|
||||||
|
|
||||||
|
if (config.get('xpack.reporting.capture.browser.type') === PHANTOM) {
|
||||||
|
server.log(['reporting', 'warning'], 'Phantom browser type for reporting will be deprecated starting in 7.0');
|
||||||
|
}
|
||||||
|
|
||||||
const { xpack_main: xpackMainPlugin } = server.plugins;
|
const { xpack_main: xpackMainPlugin } = server.plugins;
|
||||||
|
|
||||||
mirrorPluginStatus(xpackMainPlugin, this);
|
mirrorPluginStatus(xpackMainPlugin, this);
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
/*
|
||||||
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||||
|
* or more contributor license agreements. Licensed under the Elastic License;
|
||||||
|
* you may not use this file except in compliance with the Elastic License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const PHANTOM = 'phantom';
|
||||||
|
export const CHROMIUM = 'chromium';
|
|
@ -4,30 +4,28 @@
|
||||||
* you may not use this file except in compliance with the Elastic License.
|
* you may not use this file except in compliance with the Elastic License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// import getosSync from 'getos';
|
import getosSync from 'getos';
|
||||||
// import { promisify } from 'bluebird';
|
import { promisify } from 'bluebird';
|
||||||
|
import { PHANTOM, CHROMIUM } from './browser_types';
|
||||||
|
|
||||||
// const getos = promisify(getosSync);
|
const getos = promisify(getosSync);
|
||||||
|
|
||||||
// Chromium is unsupported on RHEL/CentOS before 7.0
|
// Chromium is unsupported on RHEL/CentOS before 7.0.
|
||||||
// const distroSupportsChromium = (distro, release) => {
|
const distroSupportsChromium = (distro, release) => {
|
||||||
// if (distro.toLowerCase() !== 'centos' && distro.toLowerCase () !== 'red hat linux') {
|
if (distro.toLowerCase() !== 'centos' && distro.toLowerCase () !== 'red hat linux') {
|
||||||
// return true;
|
return true;
|
||||||
// }
|
}
|
||||||
// const releaseNumber = parseInt(release, 10);
|
const releaseNumber = parseInt(release, 10);
|
||||||
// return releaseNumber >= 7.0;
|
return releaseNumber >= 7;
|
||||||
// };
|
};
|
||||||
|
|
||||||
|
|
||||||
export async function getDefaultBrowser() {
|
export async function getDefaultBrowser() {
|
||||||
return 'phantom';
|
const os = await getos();
|
||||||
|
|
||||||
// TODO: Switch to chromium once all the kinks are worked out
|
if (os.os === 'linux' && !distroSupportsChromium(os.dist, os.release)) {
|
||||||
// const os = await getos();
|
return PHANTOM;
|
||||||
//
|
} else {
|
||||||
// if (os.os === 'linux' && !distroSupportsChromium(os.dist, os.release)) {
|
return CHROMIUM;
|
||||||
// return 'phantom';
|
}
|
||||||
// } else {
|
|
||||||
// return 'chromium';
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,3 +8,4 @@ export { ensureAllBrowsersDownloaded } from './download';
|
||||||
export { createBrowserDriverFactory } from './create_browser_driver_factory';
|
export { createBrowserDriverFactory } from './create_browser_driver_factory';
|
||||||
export { getDefaultBrowser } from './default_browser';
|
export { getDefaultBrowser } from './default_browser';
|
||||||
export { getDefaultChromiumSandboxDisabled } from './default_chromium_sandbox_disabled';
|
export { getDefaultChromiumSandboxDisabled } from './default_chromium_sandbox_disabled';
|
||||||
|
export { PHANTOM, CHROMIUM } from './browser_types';
|
||||||
|
|
Loading…
Reference in a new issue