bug4811: brought StartMongoDBServer prodecure to a working state; see also the updates to the launch-mongo-replica infrastructure

This commit is contained in:
Axel Uhl
2020-11-09 23:09:38 +01:00
parent 8a150634ed
commit 6195d29482
3 changed files with 6 additions and 1 deletions
@@ -91,6 +91,7 @@ public class TestProcedures {
assertEquals(AwsLandscape.MONGO_DEFAULT_REPLICA_SET_NAME, inRs.getReplicaSet().getName());
} catch (Exception e) {
logger.log(Level.SEVERE, "Exception while trying to create a MongoDB replica", e);
throw e;
} finally {
if (startMongoDBServerProcedure.getHost() != null) {
startMongoDBServerProcedure.getHost().terminate();
@@ -246,6 +246,10 @@ extends StartHost<ShardingKey, MetricsT, MasterProcessT, ReplicaProcessT, HostT>
protected Iterable<SecurityGroup> getSecurityGroups() {
return securityGroups == null ? Collections.singleton(getLandscape().getDefaultSecurityGroupForApplicationHosts(getRegion())) : securityGroups;
}
protected boolean isSecurityGroupsSet() {
return securityGroups != null;
}
@Override
public Builder<T, ShardingKey, MetricsT, MasterProcessT, ReplicaProcessT, HostT> setSecurityGroups(
@@ -213,7 +213,7 @@ extends StartAwsHost<ShardingKey, MetricsT, MasterProcessT, ReplicaProcessT, Aws
@Override
public StartMongoDBServer<ShardingKey, MetricsT, MasterProcessT, ReplicaProcessT> build() throws URISyntaxException, JSchException, IOException, InterruptedException {
setTags(Optional.of(getLandscape().getTagForMongoProcess(getTags().orElse(Tags.empty()), getReplicaSetName(), MongoProcess.DEFAULT_PORT)));
if (getSecurityGroups() == null) {
if (!isSecurityGroupsSet()) {
setSecurityGroups(Collections.singleton(getLandscape().getDefaultSecurityGroupForMongoDBHosts(getRegion())));
}
return new StartMongoDBServer<>(this);