use of com.sequenceiq.periscope.domain.SecurityConfig in project cloudbreak by hortonworks.
the class ClusterService method update.
public Cluster update(Long clusterId, AmbariStack stack, boolean withPermissionCheck, ClusterState clusterState, boolean enableAutoscaling) {
Cluster cluster = withPermissionCheck ? findOneById(clusterId) : find(clusterId);
ClusterState newState = clusterState != null ? clusterState : cluster.getState();
cluster.setState(newState);
cluster.setAutoscalingEnabled(enableAutoscaling);
cluster.update(stack);
SecurityConfig sSecConf = stack.getSecurityConfig();
if (sSecConf != null) {
SecurityConfig updatedConfig = sSecConf;
SecurityConfig securityConfig = securityConfigRepository.findByClusterId(clusterId);
if (securityConfig != null) {
securityConfig.update(updatedConfig);
securityConfigRepository.save(securityConfig);
} else {
SecurityConfig sc = new SecurityConfig(sSecConf.getClientKey(), sSecConf.getClientCert(), sSecConf.getServerCert());
sc.setCluster(cluster);
sc = securityConfigRepository.save(sc);
cluster.setSecurityConfig(sc);
}
}
cluster = save(cluster);
addPrometheusAlertsToConsul(cluster);
return cluster;
}
Aggregations