use of com.sequenceiq.freeipa.service.freeipa.PrimaryGatewayFirstThenSortByFqdnComparator in project cloudbreak by hortonworks.
the class StackStartActions method stackStartAction.
@Bean(name = "START_STATE")
public Action<?, ?> stackStartAction() {
return new AbstractStackStartAction<>(StackEvent.class) {
@Value("${freeipa.delayed.stop-start-sec}")
private long delayInSec;
@Inject
private EntitlementService entitlementService;
@Override
protected void doExecute(StackStartContext context, StackEvent payload, Map<Object, Object> variables) {
stackStartService.startStack(context.getStack());
sendEvent(context);
}
@Override
protected Selectable createRequest(StackStartContext context) {
Stack stack = context.getStack();
LOGGER.debug("Assembling start request for stack: {}", stack);
List<CloudInstance> cloudInstances = stack.getNotDeletedInstanceMetaDataSet().stream().sorted(new PrimaryGatewayFirstThenSortByFqdnComparator()).map(i -> metadataConverter.convert(i)).collect(Collectors.toList());
List<CloudResource> cloudResources = getCloudResources(stack.getId());
if (entitlementService.isFmsDelayedStopStartEnabled(context.getStack().getAccountId())) {
return new DelayedStartInstancesRequest(context.getCloudContext(), context.getCloudCredential(), cloudResources, cloudInstances, delayInSec);
} else {
return new StartInstancesRequest(context.getCloudContext(), context.getCloudCredential(), cloudResources, cloudInstances);
}
}
};
}
Aggregations