Search in sources :

Example 1 with OrchestratorStateParams

use of com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams in project cloudbreak by hortonworks.

the class SshKeyService method createSshStateParams.

private OrchestratorStateParams createSshStateParams(Stack stack, String user, KeyPair keyPair, String authKeysComment, String saltState) {
    Cluster cluster = stack.getCluster();
    Set<Node> nodes = stackUtil.collectReachableNodes(stack);
    OrchestratorStateParams stateParams = new OrchestratorStateParams();
    stateParams.setState(saltState);
    stateParams.setPrimaryGatewayConfig(gatewayConfigService.getGatewayConfig(stack, stack.getPrimaryGatewayInstance(), stack.getCluster().hasGateway()));
    stateParams.setTargetHostNames(nodes.stream().map(Node::getHostname).collect(Collectors.toSet()));
    stateParams.setAllNodes(nodes);
    stateParams.setExitCriteriaModel(ClusterDeletionBasedExitCriteriaModel.clusterDeletionBasedModel(stack.getId(), cluster.getId()));
    stateParams.setStateParams(createSshParams(user, keyPair, authKeysComment));
    OrchestratorStateRetryParams retryParams = new OrchestratorStateRetryParams();
    retryParams.setMaxRetry(SSH_KEY_OPERATION_RETRY_COUNT);
    stateParams.setStateRetryParams(retryParams);
    return stateParams;
}
Also used : OrchestratorStateRetryParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateRetryParams) Node(com.sequenceiq.cloudbreak.common.orchestration.Node) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) OrchestratorStateParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams)

Example 2 with OrchestratorStateParams

use of com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams in project cloudbreak by hortonworks.

the class SshKeyService method removeSshPublicKeyFromHosts.

public void removeSshPublicKeyFromHosts(Stack stack, String user, String authKeysComment) throws Exception {
    OrchestratorStateParams stateParams = createSshStateParams(stack, user, null, authKeysComment, REMOVE_SSH_PUBLICKEY_STATE);
    hostOrchestrator.runOrchestratorState(stateParams);
}
Also used : OrchestratorStateParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams)

Example 3 with OrchestratorStateParams

use of com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams in project cloudbreak by hortonworks.

the class SshKeyService method addSshPublicKeyToHosts.

public void addSshPublicKeyToHosts(Stack stack, String user, KeyPair keyPair, String authKeysComment) throws Exception {
    OrchestratorStateParams stateParams = createSshStateParams(stack, user, keyPair, authKeysComment, REMOVE_SSH_PUBLICKEY_STATE);
    hostOrchestrator.runOrchestratorState(stateParams);
    stateParams.setState(ADD_SSH_PUBLICKEY_STATE);
    hostOrchestrator.runOrchestratorState(stateParams);
}
Also used : OrchestratorStateParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams)

Example 4 with OrchestratorStateParams

use of com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams in project cloudbreak by hortonworks.

the class UpgradeCcmOrchestratorServiceTest method testDisableMina.

@Test
void testDisableMina() throws CloudbreakOrchestratorException {
    underTest.disableMina(STACK_ID);
    verify(hostOrchestrator).runOrchestratorState(paramCaptor.capture());
    OrchestratorStateParams params = paramCaptor.getValue();
    assertThat(params.getState()).isEqualTo("upgradeccm/disable-ccmv1");
    assertOtherStateParams(params);
}
Also used : OrchestratorStateParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams) Test(org.junit.jupiter.api.Test)

Example 5 with OrchestratorStateParams

use of com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams in project cloudbreak by hortonworks.

the class UpgradeCcmOrchestratorServiceTest method testReconfigureNginx.

@Test
void testReconfigureNginx() throws CloudbreakOrchestratorException {
    underTest.reconfigureNginx(STACK_ID);
    verify(hostOrchestrator).runOrchestratorState(paramCaptor.capture());
    OrchestratorStateParams params = paramCaptor.getValue();
    assertThat(params.getState()).isEqualTo("nginx");
    assertOtherStateParams(params);
}
Also used : OrchestratorStateParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams) Test(org.junit.jupiter.api.Test)

Aggregations

OrchestratorStateParams (com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams)21 Test (org.junit.jupiter.api.Test)7 Node (com.sequenceiq.cloudbreak.common.orchestration.Node)6 Stack (com.sequenceiq.freeipa.entity.Stack)3 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)2 InstanceMetaData (com.sequenceiq.freeipa.entity.InstanceMetaData)2 StackEvent (com.sequenceiq.freeipa.flow.stack.StackEvent)2 ClusterDeletionBasedExitCriteriaModel (com.sequenceiq.cloudbreak.core.bootstrap.service.ClusterDeletionBasedExitCriteriaModel)1 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)1 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)1 OrchestratorStateRetryParams (com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateRetryParams)1 HandlerEvent (com.sequenceiq.flow.reactor.api.handler.HandlerEvent)1 CreateFullBackupEvent (com.sequenceiq.freeipa.flow.freeipa.backup.full.event.CreateFullBackupEvent)1 StackFailureEvent (com.sequenceiq.freeipa.flow.stack.StackFailureEvent)1 StackBasedExitCriteriaModel (com.sequenceiq.freeipa.orchestrator.StackBasedExitCriteriaModel)1