use of com.sequenceiq.freeipa.service.stack.instance.InstanceGroupService in project cloudbreak by hortonworks.
the class FreeIpaDownscaleActions method updateMetadataAction.
@Bean(name = "DOWNSCALE_UPDATE_METADATA_STATE")
public Action<?, ?> updateMetadataAction() {
return new AbstractDownscaleAction<>(RemoveHostsFromOrchestrationSuccess.class) {
@Inject
private InstanceGroupService instanceGroupService;
@Override
protected void doExecute(StackContext context, RemoveHostsFromOrchestrationSuccess payload, Map<Object, Object> variables) {
Stack stack = context.getStack();
stackUpdater.updateStackStatus(stack.getId(), getInProgressStatus(variables), "Updating metadata");
List<String> repairInstanceIds = getInstanceIds(variables);
terminationService.finalizeTermination(stack.getId(), repairInstanceIds);
terminationService.finalizeTerminationForInstancesWithoutInstanceIds(stack.getId());
if (!isRepair(variables)) {
int nodeCount = getInstanceCountByGroup(variables);
instanceGroupService.findByStackId(stack.getId()).forEach(instanceGroup -> {
instanceGroup.setNodeCount(nodeCount);
instanceGroupService.save(instanceGroup);
});
}
sendEvent(context, UPDATE_METADATA_FINISHED_EVENT.selector(), new StackEvent(stack.getId()));
}
};
}
Aggregations