Search in sources :

Example 6 with SecurityConfig

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;
}
Also used : ClusterState(com.sequenceiq.periscope.api.model.ClusterState) SecurityConfig(com.sequenceiq.periscope.domain.SecurityConfig) Cluster(com.sequenceiq.periscope.domain.Cluster)

Aggregations

SecurityConfig (com.sequenceiq.periscope.domain.SecurityConfig)6 Ambari (com.sequenceiq.periscope.domain.Ambari)2 AmbariStack (com.sequenceiq.periscope.model.AmbariStack)2 AmbariAddressJson (com.sequenceiq.cloudbreak.api.model.AmbariAddressJson)1 AutoscaleClusterResponse (com.sequenceiq.cloudbreak.api.model.AutoscaleClusterResponse)1 CertificateResponse (com.sequenceiq.cloudbreak.api.model.CertificateResponse)1 StackResponse (com.sequenceiq.cloudbreak.api.model.StackResponse)1 ClusterState (com.sequenceiq.periscope.api.model.ClusterState)1 Cluster (com.sequenceiq.periscope.domain.Cluster)1 PeriscopeUser (com.sequenceiq.periscope.domain.PeriscopeUser)1 TlsConfiguration (com.sequenceiq.periscope.model.TlsConfiguration)1