Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn in plugin cli if using deprecated --plugin-dir option #15390

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/cli_plugin/install/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Logger from '../lib/logger';
import { getConfig } from '../../server/path';
import { parse, parseMilliseconds } from './settings';
import logWarnings from '../lib/log_warnings';
import { warnIfUsingPluginDirOption } from '../lib/warn_if_plugin_dir_option';

function processCommand(command, options) {
let settings;
Expand All @@ -16,6 +17,8 @@ function processCommand(command, options) {
}

const logger = new Logger(settings);

warnIfUsingPluginDirOption(options, fromRoot('plugins'), logger);
logWarnings(settings, logger);
install(settings, logger);
}
Expand All @@ -37,7 +40,7 @@ export default function pluginInstall(program) {
)
.option(
'-d, --plugin-dir <path>',
'path to the directory where plugins are stored',
'path to the directory where plugins are stored (DEPRECATED, known to not work for all plugins)',
fromRoot('plugins')
)
.description('install a plugin',
Expand Down
8 changes: 8 additions & 0 deletions src/cli_plugin/lib/warn_if_plugin_dir_option.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export function warnIfUsingPluginDirOption(options, defaultValue, logger) {
if (options.pluginDir !== defaultValue) {
logger.log(
'Warning: Using the -d, --plugin-dir option is deprecated, and is ' +
'known to not work for all plugins, including X-Pack.'
);
}
}
5 changes: 4 additions & 1 deletion src/cli_plugin/list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import list from './list';
import Logger from '../lib/logger';
import { parse } from './settings';
import logWarnings from '../lib/log_warnings';
import { warnIfUsingPluginDirOption } from '../lib/warn_if_plugin_dir_option';

function processCommand(command, options) {
let settings;
Expand All @@ -15,6 +16,8 @@ function processCommand(command, options) {
}

const logger = new Logger(settings);

warnIfUsingPluginDirOption(options, fromRoot('plugins'), logger);
logWarnings(settings, logger);
list(settings, logger);
}
Expand All @@ -24,7 +27,7 @@ export default function pluginList(program) {
.command('list')
.option(
'-d, --plugin-dir <path>',
'path to the directory where plugins are stored',
'path to the directory where plugins are stored (DEPRECATED, known to not work for all plugins)',
fromRoot('plugins')
)
.description('list installed plugins')
Expand Down
5 changes: 4 additions & 1 deletion src/cli_plugin/remove/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Logger from '../lib/logger';
import { parse } from './settings';
import { getConfig } from '../../server/path';
import logWarnings from '../lib/log_warnings';
import { warnIfUsingPluginDirOption } from '../lib/warn_if_plugin_dir_option';

function processCommand(command, options) {
let settings;
Expand All @@ -16,6 +17,8 @@ function processCommand(command, options) {
}

const logger = new Logger(settings);

warnIfUsingPluginDirOption(options, fromRoot('plugins'), logger);
logWarnings(settings, logger);
remove(settings, logger);
}
Expand All @@ -32,7 +35,7 @@ export default function pluginRemove(program) {
)
.option(
'-d, --plugin-dir <path>',
'path to the directory where plugins are stored',
'path to the directory where plugins are stored (DEPRECATED, known to not work for all plugins)',
fromRoot('plugins')
)
.description('remove a plugin',
Expand Down