Skip to content

Commit

Permalink
Revert "Adding support for custom override for role_manager (#917)" (#…
Browse files Browse the repository at this point in the history
…926)

This reverts commit ae1fbff.

Co-authored-by: Sumanth Pasupuleti <[email protected]>
  • Loading branch information
sumanth-pasupuleti and Sumanth Pasupuleti authored Mar 23, 2021
1 parent 983bd1a commit 369358f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -561,11 +561,6 @@ default String getAuthorizer() {
return "org.apache.cassandra.auth.AllowAllAuthorizer";
}

/** Defaults to 'CassandraRoleManager'. */
default String getRoleManager() {
return "org.apache.cassandra.auth.CassandraRoleManager";
}

/** @return true/false, if Cassandra needs to be started manually */
default boolean doesCassandraStartManually() {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,6 @@ public String getAuthorizer() {
PRIAM_PRE + ".authorizer", "org.apache.cassandra.auth.AllowAllAuthorizer");
}

public String getRoleManager() {
return config.get(
PRIAM_PRE + ".roleManager", "org.apache.cassandra.auth.CassandraRoleManager");
}

@Override
public boolean doesCassandraStartManually() {
return config.get(PRIAM_PRE + ".cass.manual.start.enable", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ public void writeAllProperties(String yamlLocation, String hostname, String seed
map.put("hinted_handoff_throttle_in_kb", config.getHintedHandoffThrottleKb());
map.put("authenticator", config.getAuthenticator());
map.put("authorizer", config.getAuthorizer());
map.put("role_manager", config.getRoleManager());
map.put("internode_compression", config.getInternodeCompression());
map.put("dynamic_snitch", config.isDynamicSnitchEnabled());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class FakeConfiguration implements IConfiguration {

private final String appName;
private String restorePrefix = "";
private String roleManager = "";
private boolean mayCreateNewToken;
private ImmutableList<String> racs;
private boolean usePrivateIp;
Expand Down Expand Up @@ -203,16 +202,6 @@ public ImmutableSet<String> getTunablePropertyFiles() {
return ImmutableSet.of(path + "/cassandra-rackdc.properties");
}

@Override
public String getRoleManager() {
return this.roleManager;
}

public FakeConfiguration setRoleManager(String roleManager) {
this.roleManager = roleManager;
return this;
}

public String getRAC() {
return "my_zone";
}
Expand Down
33 changes: 11 additions & 22 deletions priam/src/test/java/com/netflix/priam/tuner/StandardTunerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,36 +142,25 @@ public void addExtraParams() throws Exception {
extraParamValues.put(priamKeyName2, "test");
extraParamValues.put(priamKeyName3, "randomKeyValue");
extraParamValues.put(priamKeyName4, "randomGroupValue");

Map map =
applyFakeConfiguration(new TunerConfiguration(extraConfigParam, extraParamValues));
Assert.assertEquals("your_host", map.get("listen_address"));
Assert.assertEquals("true", ((Map) map.get("client_encryption_options")).get("optional"));
Assert.assertEquals(
"test", ((Map) map.get("client_encryption_options")).get("keystore_password"));
Assert.assertEquals("randomKeyValue", map.get("randomKey"));
Assert.assertEquals("randomGroupValue", ((Map) map.get("randomGroup")).get("randomKey"));
}

@Test
public void testRoleManagerOverride() throws Exception {
String roleManagerOverride = "org.apache.cassandra.auth.CustomRoleManager";
Map map =
applyFakeConfiguration(new FakeConfiguration().setRoleManager(roleManagerOverride));
Assert.assertEquals(roleManagerOverride, map.get("role_manager"));
}

private Map applyFakeConfiguration(FakeConfiguration fakeConfiguration) throws Exception {
StandardTuner tuner =
new StandardTuner(fakeConfiguration, backupRestoreConfig, instanceInfo);
new StandardTuner(
new TunerConfiguration(extraConfigParam, extraParamValues),
backupRestoreConfig,
instanceInfo);
Files.copy(new File("src/main/resources/incr-restore-cassandra.yaml"), target);
tuner.writeAllProperties(target.getAbsolutePath(), "your_host", "YourSeedProvider");

// Read the tuned file and verify
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
Yaml yaml = new Yaml(options);
return yaml.load(new FileInputStream(target));
Map map = yaml.load(new FileInputStream(target));
Assert.assertEquals("your_host", map.get("listen_address"));
Assert.assertEquals("true", ((Map) map.get("client_encryption_options")).get("optional"));
Assert.assertEquals(
"test", ((Map) map.get("client_encryption_options")).get("keystore_password"));
Assert.assertEquals("randomKeyValue", map.get("randomKey"));
Assert.assertEquals("randomGroupValue", ((Map) map.get("randomGroup")).get("randomKey"));
}

private class TunerConfiguration extends FakeConfiguration {
Expand Down

0 comments on commit 369358f

Please sign in to comment.