Skip to content

Commit

Permalink
Fix test + Hadoop (elastic#119765)
Browse files Browse the repository at this point in the history
Backport of elastic#119742
  • Loading branch information
ldematte authored Jan 8, 2025
1 parent 95c87fd commit d521232
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static List<String> systemJvmOptions(Settings nodeSettings, final Map<String, St
maybeSetActiveProcessorCount(nodeSettings),
maybeSetReplayFile(distroType, isHotspot),
maybeWorkaroundG1Bug(),
maybeAllowSecurityManager(useEntitlements),
maybeAllowSecurityManager(),
maybeAttachEntitlementAgent(useEntitlements)
).flatMap(s -> s).toList();
}
Expand Down Expand Up @@ -148,12 +148,9 @@ private static Stream<String> maybeWorkaroundG1Bug() {
return Stream.of();
}

private static Stream<String> maybeAllowSecurityManager(boolean useEntitlements) {
if (useEntitlements == false) {
// Will become conditional on useEntitlements once entitlements can run without SM
return Stream.of("-Djava.security.manager=allow");
}
return Stream.of();
private static Stream<String> maybeAllowSecurityManager() {
// Will become conditional on useEntitlements once entitlements can run without SM
return Stream.of("-Djava.security.manager=allow");
}

private static Stream<String> maybeAttachEntitlementAgent(boolean useEntitlements) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@
public class ExampleSecurityExtension implements SecurityExtension {

static {
// check that the extension's policy works.
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
System.getSecurityManager().checkPropertyAccess("myproperty");
return null;
});
final boolean useEntitlements = Boolean.parseBoolean(System.getProperty("es.entitlements.enabled"));
if (useEntitlements == false) {
// check that the extension's policy works.
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
System.getSecurityManager().checkPropertyAccess("myproperty");
return null;
});
}
}

@Override
Expand Down

0 comments on commit d521232

Please sign in to comment.