Remove silent batch mode from install plugin (#29359)
Today we have a silent batch mode in the install plugin command when standard input is closed or there is no tty. It appears that historically this was useful when running tests where we want to accept plugin permissions without having to acknowledge them. Now that we have an explicit batch mode flag, this use-case is removed. The motivation for removing this now is that there is another place where silent batch mode arises and that is when a user attempts to install a plugin inside a Docker container without keeping standard input open and attaching a tty. In this case, the install plugin command will treat the situation as a silent batch mode and therefore the user will never have the chance to acknowledge the additional permissions required by a plugin. This commit removes this silent batch mode in favor of using the --batch flag when running tests and requiring the user to take explicit action to acknowledge the additional permissions (either by leaving standard input open and attaching a tty, or by passing the --batch flags themselves). Note that with this change the user will now see a null pointer exception when they try to install a plugin in a Docker container without keeping standard input open and attaching a tty. This will be addressed in an immediate follow-up, but because the implications of that change are larger, they should be handled separately from this one.
This commit is contained in:
parent
8fdca6a89a
commit
5cdd831a31
|
@ -494,7 +494,7 @@ class ClusterFormationTasks {
|
|||
* the short name requiring the path to already exist.
|
||||
*/
|
||||
final Object esPluginUtil = "${-> node.binPath().resolve('elasticsearch-plugin').toString()}"
|
||||
final Object[] args = [esPluginUtil, 'install', file]
|
||||
final Object[] args = [esPluginUtil, 'install', '--batch', file]
|
||||
return configureExecTask(name, project, setup, node, args)
|
||||
}
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ class InstallPluginCommand extends EnvironmentAwareCommand {
|
|||
@Override
|
||||
protected void execute(Terminal terminal, OptionSet options, Environment env) throws Exception {
|
||||
String pluginId = arguments.value(options);
|
||||
boolean isBatch = options.has(batchOption) || System.console() == null;
|
||||
final boolean isBatch = options.has(batchOption);
|
||||
execute(terminal, pluginId, isBatch, env);
|
||||
}
|
||||
|
||||
|
|
|
@ -416,7 +416,7 @@ fi
|
|||
|
||||
@test "[$GROUP] install a sample plugin with different logging modes and check output" {
|
||||
local relativePath=${1:-$(readlink -m custom-settings-*.zip)}
|
||||
sudo -E -u $ESPLUGIN_COMMAND_USER "$ESHOME/bin/elasticsearch-plugin" install "file://$relativePath" > /tmp/plugin-cli-output
|
||||
sudo -E -u $ESPLUGIN_COMMAND_USER "$ESHOME/bin/elasticsearch-plugin" install --batch "file://$relativePath" > /tmp/plugin-cli-output
|
||||
# exclude progress line
|
||||
local loglines=$(cat /tmp/plugin-cli-output | grep -v "^[[:cntrl:]]" | wc -l)
|
||||
[ "$loglines" -eq "2" ] || {
|
||||
|
@ -427,7 +427,7 @@ fi
|
|||
remove_plugin_example
|
||||
|
||||
local relativePath=${1:-$(readlink -m custom-settings-*.zip)}
|
||||
sudo -E -u $ESPLUGIN_COMMAND_USER ES_JAVA_OPTS="-Des.logger.level=DEBUG" "$ESHOME/bin/elasticsearch-plugin" install "file://$relativePath" > /tmp/plugin-cli-output
|
||||
sudo -E -u $ESPLUGIN_COMMAND_USER ES_JAVA_OPTS="-Des.logger.level=DEBUG" "$ESHOME/bin/elasticsearch-plugin" install --batch "file://$relativePath" > /tmp/plugin-cli-output
|
||||
local loglines=$(cat /tmp/plugin-cli-output | grep -v "^[[:cntrl:]]" | wc -l)
|
||||
[ "$loglines" -gt "2" ] || {
|
||||
echo "Expected more than 2 lines excluding progress bar but the output had $loglines lines and was:"
|
||||
|
|
|
@ -47,9 +47,9 @@ install_plugin() {
|
|||
fi
|
||||
|
||||
if [ -z "$umask" ]; then
|
||||
sudo -E -u $ESPLUGIN_COMMAND_USER "$ESHOME/bin/elasticsearch-plugin" install -batch "file://$path"
|
||||
sudo -E -u $ESPLUGIN_COMMAND_USER "$ESHOME/bin/elasticsearch-plugin" install --batch "file://$path"
|
||||
else
|
||||
sudo -E -u $ESPLUGIN_COMMAND_USER bash -c "umask $umask && \"$ESHOME/bin/elasticsearch-plugin\" install -batch \"file://$path\""
|
||||
sudo -E -u $ESPLUGIN_COMMAND_USER bash -c "umask $umask && \"$ESHOME/bin/elasticsearch-plugin\" install --batch \"file://$path\""
|
||||
fi
|
||||
|
||||
#check we did not accidentially create a log file as root as /usr/share/elasticsearch
|
||||
|
|
Loading…
Reference in New Issue