@@ -113,6 +113,8 @@ typedef SSIZE_T ssize_t;
113
113
#define CCM_CONFIGURATION_KEY_CASSANDRA_VERSION " cassandra_version"
114
114
#define CCM_CONFIGURATION_KEY_USE_GIT " use_git"
115
115
#define CCM_CONFIGURATION_KEY_BRANCH_TAG " branch_tag"
116
+ #define CCM_CONFIGURATION_KEY_USE_INSTALL_DIR " use_install_dir"
117
+ #define CCM_CONFIGURATION_KEY_INSTALL_DIR " install_dir"
116
118
#define CCM_CONFIGURATION_KEY_DEPLOYMENT_TYPE " deployment_type"
117
119
#define CCM_CONFIGURATION_KEY_USE_DSE " use_dse"
118
120
#define CCM_CONFIGURATION_KEY_DSE_VERSION " dse_version"
@@ -139,7 +141,7 @@ const std::string DSE_WORKLOADS[] = {
139
141
};
140
142
const std::vector<std::string> CCM::Bridge::dse_workloads_ (DSE_WORKLOADS,
141
143
DSE_WORKLOADS + sizeof (DSE_WORKLOADS) / sizeof(DSE_WORKLOADS[0 ]));
142
- const CCM::DseWorkload DEFAULT_WORKLOAD[] {
144
+ const CCM::DseWorkload DEFAULT_WORKLOAD[] = {
143
145
CCM::DSE_WORKLOAD_CASSANDRA
144
146
};
145
147
const std::vector<CCM::DseWorkload> CCM::Bridge::DEFAULT_DSE_WORKLOAD (
@@ -151,6 +153,8 @@ using namespace CCM;
151
153
CCM::Bridge::Bridge (CassVersion server_version /* = DEFAULT_CASSANDRA_VERSION*/ ,
152
154
bool use_git /* = DEFAULT_USE_GIT*/ ,
153
155
const std::string& branch_tag /* ""*/ ,
156
+ bool use_install_dir /* =DEFAULT_USE_INSTALL_DIR*/ ,
157
+ const std::string& install_dir /* =""*/ ,
154
158
bool use_dse /* = DEFAULT_USE_DSE*/ ,
155
159
std::vector<DseWorkload> dse_workload /* = DEFAULT_DSE_WORKLOAD*/ ,
156
160
const std::string& cluster_prefix /* = DEFAULT_CLUSTER_PREFIX*/ ,
@@ -169,6 +173,8 @@ CCM::Bridge::Bridge(CassVersion server_version /*= DEFAULT_CASSANDRA_VERSION*/,
169
173
, dse_version_(DEFAULT_DSE_VERSION)
170
174
, use_git_(use_git)
171
175
, branch_tag_(branch_tag)
176
+ , use_install_dir_(use_install_dir)
177
+ , install_dir_(install_dir)
172
178
, use_dse_(use_dse)
173
179
, dse_workload_(dse_workload)
174
180
, cluster_prefix_(cluster_prefix)
@@ -198,6 +204,11 @@ CCM::Bridge::Bridge(CassVersion server_version /*= DEFAULT_CASSANDRA_VERSION*/,
198
204
dse_version_ = DseVersion (server_version.to_string ());
199
205
cassandra_version_ = dse_version_.get_cass_version ();
200
206
}
207
+
208
+ // Determine if installation directory can be used
209
+ if (use_install_dir_ && install_dir_.empty ()) {
210
+ throw BridgeException (" Unable to use Installation Directory: Directory must not be blank" );
211
+ }
201
212
#ifdef CASS_USE_LIBSSH2
202
213
// Determine if libssh2 needs to be initialized
203
214
if (deployment_type_ == DeploymentType::REMOTE) {
@@ -223,6 +234,7 @@ CCM::Bridge::Bridge(const std::string& configuration_file)
223
234
: cassandra_version_ (DEFAULT_CASSANDRA_VERSION)
224
235
, dse_version_ (DEFAULT_DSE_VERSION)
225
236
, use_git_ (DEFAULT_USE_GIT)
237
+ , use_install_dir_ (DEFAULT_USE_INSTALL_DIR)
226
238
, use_dse_ (DEFAULT_USE_DSE)
227
239
, dse_workload_ (DEFAULT_DSE_WORKLOAD)
228
240
, cluster_prefix_ (DEFAULT_CLUSTER_PREFIX)
@@ -276,6 +288,17 @@ CCM::Bridge::Bridge(const std::string& configuration_file)
276
288
}
277
289
} else if (key.compare (CCM_CONFIGURATION_KEY_BRANCH_TAG) == 0 ) {
278
290
branch_tag_ = value;
291
+ } else if (key.compare (CCM_CONFIGURATION_KEY_USE_INSTALL_DIR) == 0 ) {
292
+ // Convert the value
293
+ std::stringstream valueStream (value);
294
+ if (!(valueStream >> std::boolalpha >> use_install_dir_).fail ()) {
295
+ continue ;
296
+ } else {
297
+ LOG_ERROR (" Invalid Flag [" << value << " ] for Use Install Directory: Using default [" << DEFAULT_USE_INSTALL_DIR << " ]" );
298
+ use_install_dir_ = DEFAULT_USE_INSTALL_DIR;
299
+ }
300
+ } else if (key.compare (CCM_CONFIGURATION_KEY_INSTALL_DIR) == 0 ) {
301
+ install_dir_ = value;
279
302
} else if (key.compare (CCM_CONFIGURATION_KEY_USE_DSE) == 0 ) {
280
303
// Convert the value
281
304
std::stringstream valueStream (value);
@@ -371,6 +394,11 @@ CCM::Bridge::Bridge(const std::string& configuration_file)
371
394
cassandra_version_ = dse_version_.get_cass_version ();
372
395
}
373
396
397
+ // Determine if installation directory can be used
398
+ if (use_install_dir_ && install_dir_.empty ()) {
399
+ throw BridgeException (" Unable to use Installation Directory: Directory must not be blank" );
400
+ }
401
+
374
402
// Display the configuration settings being used
375
403
LOG (" Host: " << host_);
376
404
LOG (" Cassandra Version: " << cassandra_version_.to_string ());
@@ -380,6 +408,9 @@ CCM::Bridge::Bridge(const std::string& configuration_file)
380
408
if (use_git_ && !branch_tag_.empty ()) {
381
409
LOG (" Branch/Tag: " << branch_tag_);
382
410
}
411
+ if (use_install_dir_ && !install_dir_.empty ()) {
412
+ LOG (" Installation Directory: " << install_dir_);
413
+ }
383
414
LOG (" Cluster Prefix: " << cluster_prefix_);
384
415
LOG (" Deployment Type: " << deployment_type_.to_string ());
385
416
#ifdef CASS_USE_LIBSSH2
@@ -544,31 +575,35 @@ bool CCM::Bridge::create_cluster(std::vector<unsigned short> data_center_nodes,
544
575
// Create the cluster create command and execute
545
576
std::vector<std::string> create_command;
546
577
create_command.push_back (" create" );
547
- create_command.push_back (" -v" );
548
- if (use_dse_) {
549
- if (use_git_) {
550
- if (branch_tag_.empty ()) {
551
- create_command.push_back (" git:" + dse_version_.to_string ());
578
+ if (use_install_dir_ && !install_dir_.empty ()) {
579
+ create_command.push_back (" --install-dir=" + install_dir_);
580
+ } else {
581
+ create_command.push_back (" -v" );
582
+ if (use_dse_) {
583
+ if (use_git_) {
584
+ if (branch_tag_.empty ()) {
585
+ create_command.push_back (" git:" + dse_version_.to_string ());
586
+ } else {
587
+ create_command.push_back (" git:" + branch_tag_);
588
+ }
552
589
} else {
553
- create_command.push_back (" git:" + branch_tag_);
590
+ create_command.push_back (dse_version_.to_string ());
591
+ }
592
+ create_command.push_back (" --dse" );
593
+ if (dse_credentials_type_ == DseCredentialsType::USERNAME_PASSWORD) {
594
+ create_command.push_back (" --dse-username=" + dse_username_);
595
+ create_command.push_back (" --dse-password=" + dse_password_);
554
596
}
555
597
} else {
556
- create_command.push_back (dse_version_.to_string ());
557
- }
558
- create_command.push_back (" --dse" );
559
- if (dse_credentials_type_ == DseCredentialsType::USERNAME_PASSWORD) {
560
- create_command.push_back (" --dse-username=" + dse_username_);
561
- create_command.push_back (" --dse-password=" + dse_password_);
562
- }
563
- } else {
564
- if (use_git_) {
565
- if (branch_tag_.empty ()) {
566
- create_command.push_back (" git:cassandra-" + cassandra_version_.to_string ());
598
+ if (use_git_) {
599
+ if (branch_tag_.empty ()) {
600
+ create_command.push_back (" git:cassandra-" + cassandra_version_.to_string ());
601
+ } else {
602
+ create_command.push_back (" git:" + branch_tag_);
603
+ }
567
604
} else {
568
- create_command.push_back (" git: " + branch_tag_ );
605
+ create_command.push_back (cassandra_version_. to_string () );
569
606
}
570
- } else {
571
- create_command.push_back (cassandra_version_.to_string ());
572
607
}
573
608
}
574
609
create_command.push_back (" -b" );
0 commit comments