Skip to content

Commit 2045468

Browse files
committed
HADOOP-18975. FIPs. only set the option once, but always do it
Change-Id: I62157b716c0b93ee6684064fae70f89aac10b8d5
1 parent 73992ba commit 2045468

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/DefaultS3ClientFactory.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ private <BuilderT extends S3BaseClientBuilder<BuilderT, ClientT>, ClientT> Build
175175
.pathStyleAccessEnabled(parameters.isPathStyleAccess())
176176
.build();
177177

178-
builder.fipsEnabled(parameters.isFipsEnabled());
179-
180178
return builder
181179
.overrideConfiguration(createClientOverrideConfiguration(parameters, conf))
182180
.credentialsProvider(parameters.getCredentialSet())
@@ -260,12 +258,14 @@ private <BuilderT extends S3BaseClientBuilder<BuilderT, ClientT>, ClientT> void
260258
region = Region.of(configuredRegion);
261259
}
262260

263-
// FIPs? Set it, then reject any attempt to set an endpoint
261+
// FIPs? Log it, then reject any attempt to set an endpoint
264262
final boolean fipsEnabled = parameters.isFipsEnabled();
265263
if (fipsEnabled) {
266264
LOG.debug("Enabling FIPS mode");
267-
builder.fipsEnabled(true);
268265
}
266+
// always setting it guarantees the value is non-null,
267+
// which tests expect.
268+
builder.fipsEnabled(fipsEnabled);
269269

270270
if (endpoint != null) {
271271
checkArgument(!fipsEnabled,

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AEndpointRegion.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ public void beforeExecution(Context.BeforeExecution context,
293293
// verify the fips state matches expectation.
294294
Assertions.assertThat(executionAttributes.getAttribute(
295295
AwsExecutionAttribute.FIPS_ENDPOINT_ENABLED))
296-
.describedAs("Incorrect FIPS flag set").isEqualTo(isFips);
296+
.describedAs("Incorrect FIPS flag set in execution attributes")
297+
.isNotNull()
298+
.isEqualTo(isFips);
297299

298300
// We don't actually want to make a request, so exit early.
299301
throw AwsServiceException.builder().message(EXCEPTION_THROWN_BY_INTERCEPTOR).build();
@@ -309,6 +311,7 @@ public void beforeExecution(Context.BeforeExecution context,
309311
* @param expectedRegion the region that should be set in the client.
310312
* @param isFips is this a FIPS endpoint?
311313
* @return the client.
314+
* @throws IOException IO problems
312315
*/
313316
@SuppressWarnings("deprecation")
314317
private S3Client createS3Client(Configuration conf,

0 commit comments

Comments
 (0)