Don't use PosixPermission on Windows, when creating temp plugin folders
This commit is contained in:
parent
f71f0d6010
commit
ee95c0a384
|
@ -21,6 +21,7 @@ package org.elasticsearch.plugins;
|
||||||
|
|
||||||
import joptsimple.OptionSet;
|
import joptsimple.OptionSet;
|
||||||
import joptsimple.OptionSpec;
|
import joptsimple.OptionSpec;
|
||||||
|
import org.apache.lucene.util.Constants;
|
||||||
import org.apache.lucene.util.IOUtils;
|
import org.apache.lucene.util.IOUtils;
|
||||||
import org.elasticsearch.Build;
|
import org.elasticsearch.Build;
|
||||||
import org.elasticsearch.Version;
|
import org.elasticsearch.Version;
|
||||||
|
@ -241,6 +242,10 @@ class InstallPluginCommand extends Command {
|
||||||
|
|
||||||
private Path unzip(Path zip, Path pluginsDir) throws IOException, UserError {
|
private Path unzip(Path zip, Path pluginsDir) throws IOException, UserError {
|
||||||
// unzip plugin to a staging temp dir
|
// unzip plugin to a staging temp dir
|
||||||
|
final Path target;
|
||||||
|
if (Constants.WINDOWS) {
|
||||||
|
target = Files.createTempDirectory(pluginsDir, ".installing-");
|
||||||
|
} else {
|
||||||
Set<PosixFilePermission> perms = new HashSet<>();
|
Set<PosixFilePermission> perms = new HashSet<>();
|
||||||
perms.add(PosixFilePermission.OWNER_EXECUTE);
|
perms.add(PosixFilePermission.OWNER_EXECUTE);
|
||||||
perms.add(PosixFilePermission.OWNER_READ);
|
perms.add(PosixFilePermission.OWNER_READ);
|
||||||
|
@ -249,7 +254,8 @@ class InstallPluginCommand extends Command {
|
||||||
perms.add(PosixFilePermission.GROUP_EXECUTE);
|
perms.add(PosixFilePermission.GROUP_EXECUTE);
|
||||||
perms.add(PosixFilePermission.OTHERS_READ);
|
perms.add(PosixFilePermission.OTHERS_READ);
|
||||||
perms.add(PosixFilePermission.OTHERS_EXECUTE);
|
perms.add(PosixFilePermission.OTHERS_EXECUTE);
|
||||||
Path target = Files.createTempDirectory(pluginsDir, ".installing-", PosixFilePermissions.asFileAttribute(perms));
|
target = Files.createTempDirectory(pluginsDir, ".installing-", PosixFilePermissions.asFileAttribute(perms));
|
||||||
|
}
|
||||||
Files.createDirectories(target);
|
Files.createDirectories(target);
|
||||||
|
|
||||||
boolean hasEsDir = false;
|
boolean hasEsDir = false;
|
||||||
|
|
Loading…
Reference in New Issue