@@ -62,6 +62,7 @@ public class CcmBridge implements AutoCloseable {
6262
6363 private final Map <String , Object > cassandraConfiguration ;
6464 private final Map <String , Object > dseConfiguration ;
65+ private final List <String > rawDseYaml ;
6566 private final List <String > createOptions ;
6667 private final List <String > dseWorkloads ;
6768
@@ -127,6 +128,7 @@ private CcmBridge(
127128 String ipPrefix ,
128129 Map <String , Object > cassandraConfiguration ,
129130 Map <String , Object > dseConfiguration ,
131+ List <String > dseConfigurationRawYaml ,
130132 List <String > createOptions ,
131133 Collection <String > jvmArgs ,
132134 List <String > dseWorkloads ) {
@@ -145,6 +147,7 @@ private CcmBridge(
145147 this .ipPrefix = ipPrefix ;
146148 this .cassandraConfiguration = cassandraConfiguration ;
147149 this .dseConfiguration = dseConfiguration ;
150+ this .rawDseYaml = dseConfigurationRawYaml ;
148151 this .createOptions = createOptions ;
149152
150153 StringBuilder allJvmArgs = new StringBuilder ("" );
@@ -214,6 +217,9 @@ public void create() {
214217 for (Map .Entry <String , Object > conf : dseConfiguration .entrySet ()) {
215218 execute ("updatedseconf" , String .format ("%s:%s" , conf .getKey (), conf .getValue ()));
216219 }
220+ for (String yaml : rawDseYaml ) {
221+ executeUnsanitized ("updatedseconf" , "-y" , yaml );
222+ }
217223 if (!dseWorkloads .isEmpty ()) {
218224 execute ("setworkload" , String .join ("," , dseWorkloads ));
219225 }
@@ -259,9 +265,24 @@ synchronized void execute(String... args) {
259265 + String .join (" " , args )
260266 + " --config-dir="
261267 + configDirectory .toFile ().getAbsolutePath ();
262- logger .debug ("Executing: " + command );
268+
269+ execute (CommandLine .parse (command ));
270+ }
271+
272+ synchronized void executeUnsanitized (String ... args ) {
273+ String command = "ccm " ;
263274
264275 CommandLine cli = CommandLine .parse (command );
276+ for (String arg : args ) {
277+ cli .addArgument (arg , false );
278+ }
279+ cli .addArgument ("--config-dir=" + configDirectory .toFile ().getAbsolutePath ());
280+
281+ execute (cli );
282+ }
283+
284+ private void execute (CommandLine cli ) {
285+ logger .debug ("Executing: " + cli );
265286 ExecuteWatchdog watchDog = new ExecuteWatchdog (TimeUnit .MINUTES .toMillis (10 ));
266287 try (LogOutputStream outStream =
267288 new LogOutputStream () {
@@ -285,13 +306,13 @@ protected void processLine(String line, int logLevel) {
285306 int retValue = executor .execute (cli );
286307 if (retValue != 0 ) {
287308 logger .error (
288- "Non-zero exit code ({}) returned from executing ccm command: {}" , retValue , command );
309+ "Non-zero exit code ({}) returned from executing ccm command: {}" , retValue , cli );
289310 }
290311 } catch (IOException ex ) {
291312 if (watchDog .killedProcess ()) {
292- throw new RuntimeException ("The command '" + command + "' was killed after 10 minutes" );
313+ throw new RuntimeException ("The command '" + cli + "' was killed after 10 minutes" );
293314 } else {
294- throw new RuntimeException ("The command '" + command + "' failed to execute" , ex );
315+ throw new RuntimeException ("The command '" + cli + "' failed to execute" , ex );
295316 }
296317 }
297318 }
@@ -329,6 +350,7 @@ public static class Builder {
329350 private int [] nodes = {1 };
330351 private final Map <String , Object > cassandraConfiguration = new LinkedHashMap <>();
331352 private final Map <String , Object > dseConfiguration = new LinkedHashMap <>();
353+ private final List <String > dseRawYaml = new ArrayList <>();
332354 private final List <String > jvmArgs = new ArrayList <>();
333355 private String ipPrefix = "127.0.0." ;
334356 private final List <String > createOptions = new ArrayList <>();
@@ -359,6 +381,11 @@ public Builder withDseConfiguration(String key, Object value) {
359381 return this ;
360382 }
361383
384+ public Builder withDseConfiguration (String rawYaml ) {
385+ dseRawYaml .add (rawYaml );
386+ return this ;
387+ }
388+
362389 public Builder withJvmArgs (String ... jvmArgs ) {
363390 Collections .addAll (this .jvmArgs , jvmArgs );
364391 return this ;
@@ -423,6 +450,7 @@ public CcmBridge build() {
423450 ipPrefix ,
424451 cassandraConfiguration ,
425452 dseConfiguration ,
453+ dseRawYaml ,
426454 createOptions ,
427455 jvmArgs ,
428456 dseWorkloads );
0 commit comments