diff --git a/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3ClientSettings.java b/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3ClientSettings.java index 183be65ffc2..4993d66c950 100644 --- a/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3ClientSettings.java +++ b/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3ClientSettings.java @@ -196,7 +196,7 @@ final class S3ClientSettings { getRepoSettingOrDefault(READ_TIMEOUT_SETTING, normalizedSettings, TimeValue.timeValueMillis(readTimeoutMillis)).millis()); final int newMaxRetries = getRepoSettingOrDefault(MAX_RETRIES_SETTING, normalizedSettings, maxRetries); final boolean newThrottleRetries = getRepoSettingOrDefault(USE_THROTTLE_RETRIES_SETTING, normalizedSettings, throttleRetries); - final boolean usePathStyleAccess = getRepoSettingOrDefault(USE_PATH_STYLE_ACCESS, normalizedSettings, pathStyleAccess); + final boolean newPathStyleAccess = getRepoSettingOrDefault(USE_PATH_STYLE_ACCESS, normalizedSettings, pathStyleAccess); final boolean newDisableChunkedEncoding = getRepoSettingOrDefault( DISABLE_CHUNKED_ENCODING, normalizedSettings, disableChunkedEncoding); final S3BasicCredentials newCredentials; @@ -210,6 +210,7 @@ final class S3ClientSettings { if (Objects.equals(endpoint, newEndpoint) && protocol == newProtocol && Objects.equals(proxyHost, newProxyHost) && proxyPort == newProxyPort && newReadTimeoutMillis == readTimeoutMillis && maxRetries == newMaxRetries && newThrottleRetries == throttleRetries && Objects.equals(credentials, newCredentials) + && newPathStyleAccess == pathStyleAccess && newDisableChunkedEncoding == disableChunkedEncoding && Objects.equals(region, newRegion) && Objects.equals(signerOverride, newSignerOverride)) { return this; @@ -225,7 +226,7 @@ final class S3ClientSettings { newReadTimeoutMillis, newMaxRetries, newThrottleRetries, - usePathStyleAccess, + newPathStyleAccess, newDisableChunkedEncoding, newRegion, newSignerOverride diff --git a/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3ClientSettingsTests.java b/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3ClientSettingsTests.java index 3c44b81ef6f..8727ca21693 100644 --- a/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3ClientSettingsTests.java +++ b/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3ClientSettingsTests.java @@ -131,7 +131,7 @@ public class S3ClientSettingsTests extends ESTestCase { { final S3ClientSettings refinedSettings = baseSettings.refine(new RepositoryMetadata("name", "type", Settings.EMPTY)); - assertTrue(refinedSettings == baseSettings); + assertSame(refinedSettings, baseSettings); } { @@ -144,6 +144,16 @@ public class S3ClientSettingsTests extends ESTestCase { assertThat(credentials.getAWSSecretKey(), is("secret_key")); assertThat(credentials.getSessionToken(), is("session_token")); } + + { + final S3ClientSettings refinedSettings = baseSettings.refine(new RepositoryMetadata("name", "type", + Settings.builder().put("path_style_access", true).build())); + assertThat(refinedSettings.pathStyleAccess, is(true)); + S3BasicSessionCredentials credentials = (S3BasicSessionCredentials) refinedSettings.credentials; + assertThat(credentials.getAWSAccessKeyId(), is("access_key")); + assertThat(credentials.getAWSSecretKey(), is("secret_key")); + assertThat(credentials.getSessionToken(), is("session_token")); + } } public void testPathStyleAccessCanBeSet() {