mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
* Default to chromium and add deprecation warning for phantom. * use int, not float
This commit is contained in:
parent
4b26d3fe3b
commit
79f9817bb7
5 changed files with 36 additions and 24 deletions
|
@ -76,8 +76,9 @@ Defaults to `3000` (3 seconds).
|
|||
`xpack.reporting.capture.browser.type`::
|
||||
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>>
|
||||
are respected.
|
||||
Defaults to `phantom`.
|
||||
are respected. This setting will be deprecated in 7.0, when Phantom support is removed.
|
||||
Defaults to `chromium`.
|
||||
|
||||
|
||||
[float]
|
||||
[[reporting-chromium-settings]]
|
||||
|
|
|
@ -15,7 +15,7 @@ import { config as appConfig } from './server/config/config';
|
|||
import { checkLicenseFactory } from './server/lib/check_license';
|
||||
import { validateConfig } from './server/lib/validate_config';
|
||||
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 { getReportingUsageCollector } from './server/usage';
|
||||
|
@ -87,7 +87,7 @@ export const reporting = (kibana) => {
|
|||
settleTime: Joi.number().integer().default(1000), //deprecated
|
||||
concurrency: Joi.number().integer().default(appConfig.concurrency), //deprecated
|
||||
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', {
|
||||
is: true,
|
||||
then: Joi.default(true),
|
||||
|
@ -145,6 +145,10 @@ export const reporting = (kibana) => {
|
|||
validateConfig(config, message => server.log(['reporting', 'warning'], 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;
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
// import getosSync from 'getos';
|
||||
// import { promisify } from 'bluebird';
|
||||
import getosSync from 'getos';
|
||||
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
|
||||
// const distroSupportsChromium = (distro, release) => {
|
||||
// if (distro.toLowerCase() !== 'centos' && distro.toLowerCase () !== 'red hat linux') {
|
||||
// return true;
|
||||
// }
|
||||
// const releaseNumber = parseInt(release, 10);
|
||||
// return releaseNumber >= 7.0;
|
||||
// };
|
||||
// Chromium is unsupported on RHEL/CentOS before 7.0.
|
||||
const distroSupportsChromium = (distro, release) => {
|
||||
if (distro.toLowerCase() !== 'centos' && distro.toLowerCase () !== 'red hat linux') {
|
||||
return true;
|
||||
}
|
||||
const releaseNumber = parseInt(release, 10);
|
||||
return releaseNumber >= 7;
|
||||
};
|
||||
|
||||
|
||||
export async function getDefaultBrowser() {
|
||||
return 'phantom';
|
||||
const os = await getos();
|
||||
|
||||
// TODO: Switch to chromium once all the kinks are worked out
|
||||
// const os = await getos();
|
||||
//
|
||||
// if (os.os === 'linux' && !distroSupportsChromium(os.dist, os.release)) {
|
||||
// return 'phantom';
|
||||
// } else {
|
||||
// return 'chromium';
|
||||
// }
|
||||
if (os.os === 'linux' && !distroSupportsChromium(os.dist, os.release)) {
|
||||
return PHANTOM;
|
||||
} else {
|
||||
return CHROMIUM;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,3 +8,4 @@ export { ensureAllBrowsersDownloaded } from './download';
|
|||
export { createBrowserDriverFactory } from './create_browser_driver_factory';
|
||||
export { getDefaultBrowser } from './default_browser';
|
||||
export { getDefaultChromiumSandboxDisabled } from './default_chromium_sandbox_disabled';
|
||||
export { PHANTOM, CHROMIUM } from './browser_types';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue