Skip to content

Commit 6e6c2bf

Browse files
committed
move security confirmation after 'plugin already installed' check, to prevent user from answering unnecessary questions.
1 parent 08233a2 commit 6e6c2bf

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

core/src/main/java/org/elasticsearch/plugins/PluginManager.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,6 @@ private void extract(PluginHandle pluginHandle, Terminal terminal, Path pluginFi
220220
PluginInfo info = PluginInfo.readFromProperties(root);
221221
terminal.println(VERBOSE, "%s", info);
222222

223-
// read optional security policy (extra permissions)
224-
// if it exists, confirm or warn the user
225-
Path policy = root.resolve(PluginInfo.ES_PLUGIN_POLICY);
226-
if (Files.exists(policy)) {
227-
PluginSecurity.readPolicy(policy, terminal, environment, batch);
228-
}
229-
230223
// check for jar hell before any copying
231224
if (info.isJvm()) {
232225
jarHellCheck(root, info.isIsolated());
@@ -239,6 +232,13 @@ private void extract(PluginHandle pluginHandle, Terminal terminal, Path pluginFi
239232
throw new IOException("plugin directory " + extractLocation.toAbsolutePath() + " already exists. To update the plugin, uninstall it first using 'remove " + pluginHandle.name + "' command");
240233
}
241234

235+
// read optional security policy (extra permissions)
236+
// if it exists, confirm or warn the user
237+
Path policy = root.resolve(PluginInfo.ES_PLUGIN_POLICY);
238+
if (Files.exists(policy)) {
239+
PluginSecurity.readPolicy(policy, terminal, environment, batch);
240+
}
241+
242242
// install plugin
243243
FileSystemUtils.copyDirectoryRecursively(root, extractLocation);
244244
terminal.println("Installed %s into %s", pluginHandle.name, extractLocation.toAbsolutePath());

0 commit comments

Comments
 (0)