switch over uses of homeFile() to binFile().getParent().
homeFile() is removed and should not be used, we need to cleanup, but this is just a rote change to get builds green. Original commit: elastic/x-pack-elasticsearch@05d0fb4a7c
This commit is contained in:
parent
0c05349d93
commit
875e2e67c5
|
@ -607,7 +607,7 @@ public class IndexAuditTrail extends AbstractComponent implements AuditTrail {
|
|||
final TransportClient transportClient = TransportClient.builder()
|
||||
.settings(Settings.builder()
|
||||
.put("name", DEFAULT_CLIENT_NAME + "-" + settings.get("name"))
|
||||
.put("path.home", environment.homeFile())
|
||||
.put("path.home", environment.binFile().getParent())
|
||||
.putArray("plugin.types", ShieldPlugin.class.getName())
|
||||
.put(clientSettings))
|
||||
.build();
|
||||
|
|
|
@ -94,7 +94,7 @@ public class FileUserPasswdStore {
|
|||
if (location == null) {
|
||||
return ShieldPlugin.resolveConfigFile(env, "users");
|
||||
}
|
||||
return env.homeFile().resolve(location);
|
||||
return env.binFile().getParent().resolve(location);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -88,7 +88,7 @@ public class FileUserRolesStore {
|
|||
if (location == null) {
|
||||
return ShieldPlugin.resolveConfigFile(env, "users_roles");
|
||||
}
|
||||
return env.homeFile().resolve(location);
|
||||
return env.binFile().getParent().resolve(location);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -148,7 +148,7 @@ public class PkiRealm extends Realm<X509AuthenticationToken> {
|
|||
|
||||
String trustStoreAlgorithm = settings.get("truststore.algorithm", System.getProperty("ssl.TrustManagerFactory.algorithm", TrustManagerFactory.getDefaultAlgorithm()));
|
||||
TrustManager[] trustManagers;
|
||||
try (InputStream in = Files.newInputStream(env.homeFile().resolve(truststorePath))) {
|
||||
try (InputStream in = Files.newInputStream(env.binFile().getParent().resolve(truststorePath))) {
|
||||
// Load TrustStore
|
||||
KeyStore ks = KeyStore.getInstance("jks");
|
||||
ks.load(in, password.toCharArray());
|
||||
|
|
|
@ -78,7 +78,7 @@ public class DnRoleMapper {
|
|||
if (location == null) {
|
||||
return ShieldPlugin.resolveConfigFile(env, DEFAULT_FILE_NAME);
|
||||
}
|
||||
return env.homeFile().resolve(location);
|
||||
return env.binFile().getParent().resolve(location);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -96,7 +96,7 @@ public class FileRolesStore extends AbstractLifecycleComponent<RolesStore> imple
|
|||
return ShieldPlugin.resolveConfigFile(env, "roles.yml");
|
||||
}
|
||||
|
||||
return env.homeFile().resolve(location);
|
||||
return env.binFile().getParent().resolve(location);
|
||||
}
|
||||
|
||||
public static ImmutableSet<String> parseFileForRoleNames(Path path, ESLogger logger) {
|
||||
|
|
|
@ -123,7 +123,7 @@ public class InternalCryptoService extends AbstractLifecycleComponent<InternalCr
|
|||
if (location == null) {
|
||||
return ShieldPlugin.resolveConfigFile(env, FILE_NAME);
|
||||
}
|
||||
return env.homeFile().resolve(location);
|
||||
return env.binFile().getParent().resolve(location);
|
||||
}
|
||||
|
||||
static SecretKey readSystemKey(Path file) {
|
||||
|
|
|
@ -69,7 +69,7 @@ public class SystemKeyTool extends CliTool {
|
|||
if (args.length > 1) {
|
||||
return exitCmd(ExitStatus.USAGE, terminal, "Too many arguments");
|
||||
}
|
||||
Path path = args.length != 0 ? env.homeFile().resolve(args[0]) : null;
|
||||
Path path = args.length != 0 ? env.binFile().getParent().resolve(args[0]) : null;
|
||||
return new Generate(terminal, path);
|
||||
}
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ public abstract class AbstractSSLService extends AbstractComponent {
|
|||
}
|
||||
|
||||
private KeyStore readKeystore(String path, String password) throws Exception {
|
||||
try (InputStream in = Files.newInputStream(env.homeFile().resolve(path))) {
|
||||
try (InputStream in = Files.newInputStream(env.binFile().getParent().resolve(path))) {
|
||||
// Load TrustStore
|
||||
KeyStore ks = KeyStore.getInstance("jks");
|
||||
assert password != null;
|
||||
|
|
|
@ -85,7 +85,7 @@ public class DnRoleMapperTests extends ElasticsearchTestCase {
|
|||
@Test
|
||||
public void testMapper_AutoReload() throws Exception {
|
||||
Path roleMappingFile = getDataPath("role_mapping.yml");
|
||||
Path file = env.homeFile().resolve("test_role_mapping.yml");
|
||||
Path file = env.binFile().getParent().resolve("test_role_mapping.yml");
|
||||
Files.copy(roleMappingFile, file, StandardCopyOption.REPLACE_EXISTING);
|
||||
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
@ -125,7 +125,7 @@ public class DnRoleMapperTests extends ElasticsearchTestCase {
|
|||
@Test
|
||||
public void testMapper_AutoReload_WithParseFailures() throws Exception {
|
||||
Path roleMappingFile = getDataPath("role_mapping.yml");
|
||||
Path file = env.homeFile().resolve("test_role_mapping.yml");
|
||||
Path file = env.binFile().getParent().resolve("test_role_mapping.yml");
|
||||
Files.copy(roleMappingFile, file, StandardCopyOption.REPLACE_EXISTING);
|
||||
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
|
|
@ -38,7 +38,7 @@ public class SystemKeyToolTests extends CliToolTestCase {
|
|||
public void init() throws Exception {
|
||||
terminal = mock(Terminal.class);
|
||||
env = mock(Environment.class);
|
||||
when(env.homeFile()).thenReturn(createTempDir());
|
||||
when(env.binFile().getParent()).thenReturn(createTempDir());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -226,7 +226,7 @@ public class HttpClient extends AbstractLifecycleComponent<HttpClient> {
|
|||
if (keyStore == null) {
|
||||
return null;
|
||||
}
|
||||
Path path = env.homeFile().resolve(keyStore);
|
||||
Path path = env.binFile().getParent().resolve(keyStore);
|
||||
if (Files.notExists(path)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ public class HttpClient extends AbstractLifecycleComponent<HttpClient> {
|
|||
// Load TrustStore
|
||||
KeyStore ks = null;
|
||||
if (trustStore != null) {
|
||||
Path trustStorePath = env.homeFile().resolve(trustStore);
|
||||
Path trustStorePath = env.binFile().getParent().resolve(trustStore);
|
||||
if (Files.exists(trustStorePath)) {
|
||||
ks = readKeystore(trustStorePath, trustStorePassword);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue