@Test public void shouldUseReachableNodes() { try { expectedException.expect(NullPointerException.class); underTest.runClusterServices(stack, cluster, List.of()); } catch (Exception e) { verify(stackUtil).collectReachableNodes(stack); throw e; } }
public void runClusterServices(@Nonnull Stack stack, @Nonnull Cluster cluster, List<String> candidateAddresses) { try { Set<Node> nodes = stackUtil.collectReachableNodes(stack); GatewayConfig primaryGatewayConfig = gatewayConfigService.getPrimaryGatewayConfig(stack); List<GatewayConfig> gatewayConfigs = gatewayConfigService.getAllGatewayConfigs(stack); SaltConfig saltConfig = createSaltConfig(stack, cluster, primaryGatewayConfig, gatewayConfigs, nodes); ExitCriteriaModel exitCriteriaModel = clusterDeletionBasedModel(stack.getId(), cluster.getId()); hostOrchestrator.initServiceRun(gatewayConfigs, nodes, saltConfig, exitCriteriaModel); if (CollectionUtils.isEmpty(candidateAddresses)) { mountDisks.mountAllDisks(stack.getId()); } else { mountDisks.mountDisksOnNewNodes(stack.getId(), new HashSet<>(candidateAddresses)); } recipeEngine.executePreClusterManagerRecipes(stack, hostGroupService.getRecipesByCluster(cluster.getId())); hostOrchestrator.runService(gatewayConfigs, nodes, saltConfig, exitCriteriaModel); } catch (CloudbreakOrchestratorCancelledException e) { throw new CancellationException(e.getMessage()); } catch (CloudbreakOrchestratorException | IOException | CloudbreakException e) { throw new CloudbreakServiceException(e.getMessage(), e); } }
ClusterHostServiceRunner { public void runClusterServices(@Nonnull Stack stack, @Nonnull Cluster cluster, List<String> candidateAddresses) { try { Set<Node> nodes = stackUtil.collectReachableNodes(stack); GatewayConfig primaryGatewayConfig = gatewayConfigService.getPrimaryGatewayConfig(stack); List<GatewayConfig> gatewayConfigs = gatewayConfigService.getAllGatewayConfigs(stack); SaltConfig saltConfig = createSaltConfig(stack, cluster, primaryGatewayConfig, gatewayConfigs, nodes); ExitCriteriaModel exitCriteriaModel = clusterDeletionBasedModel(stack.getId(), cluster.getId()); hostOrchestrator.initServiceRun(gatewayConfigs, nodes, saltConfig, exitCriteriaModel); if (CollectionUtils.isEmpty(candidateAddresses)) { mountDisks.mountAllDisks(stack.getId()); } else { mountDisks.mountDisksOnNewNodes(stack.getId(), new HashSet<>(candidateAddresses)); } recipeEngine.executePreClusterManagerRecipes(stack, hostGroupService.getRecipesByCluster(cluster.getId())); hostOrchestrator.runService(gatewayConfigs, nodes, saltConfig, exitCriteriaModel); } catch (CloudbreakOrchestratorCancelledException e) { throw new CancellationException(e.getMessage()); } catch (CloudbreakOrchestratorException | IOException | CloudbreakException e) { throw new CloudbreakServiceException(e.getMessage(), e); } } }
ClusterHostServiceRunner { public void runClusterServices(@Nonnull Stack stack, @Nonnull Cluster cluster, List<String> candidateAddresses) { try { Set<Node> nodes = stackUtil.collectReachableNodes(stack); GatewayConfig primaryGatewayConfig = gatewayConfigService.getPrimaryGatewayConfig(stack); List<GatewayConfig> gatewayConfigs = gatewayConfigService.getAllGatewayConfigs(stack); SaltConfig saltConfig = createSaltConfig(stack, cluster, primaryGatewayConfig, gatewayConfigs, nodes); ExitCriteriaModel exitCriteriaModel = clusterDeletionBasedModel(stack.getId(), cluster.getId()); hostOrchestrator.initServiceRun(gatewayConfigs, nodes, saltConfig, exitCriteriaModel); if (CollectionUtils.isEmpty(candidateAddresses)) { mountDisks.mountAllDisks(stack.getId()); } else { mountDisks.mountDisksOnNewNodes(stack.getId(), new HashSet<>(candidateAddresses)); } recipeEngine.executePreClusterManagerRecipes(stack, hostGroupService.getRecipesByCluster(cluster.getId())); hostOrchestrator.runService(gatewayConfigs, nodes, saltConfig, exitCriteriaModel); } catch (CloudbreakOrchestratorCancelledException e) { throw new CancellationException(e.getMessage()); } catch (CloudbreakOrchestratorException | IOException | CloudbreakException e) { throw new CloudbreakServiceException(e.getMessage(), e); } }  }
ClusterHostServiceRunner { public void runClusterServices(@Nonnull Stack stack, @Nonnull Cluster cluster, List<String> candidateAddresses) { try { Set<Node> nodes = stackUtil.collectReachableNodes(stack); GatewayConfig primaryGatewayConfig = gatewayConfigService.getPrimaryGatewayConfig(stack); List<GatewayConfig> gatewayConfigs = gatewayConfigService.getAllGatewayConfigs(stack); SaltConfig saltConfig = createSaltConfig(stack, cluster, primaryGatewayConfig, gatewayConfigs, nodes); ExitCriteriaModel exitCriteriaModel = clusterDeletionBasedModel(stack.getId(), cluster.getId()); hostOrchestrator.initServiceRun(gatewayConfigs, nodes, saltConfig, exitCriteriaModel); if (CollectionUtils.isEmpty(candidateAddresses)) { mountDisks.mountAllDisks(stack.getId()); } else { mountDisks.mountDisksOnNewNodes(stack.getId(), new HashSet<>(candidateAddresses)); } recipeEngine.executePreClusterManagerRecipes(stack, hostGroupService.getRecipesByCluster(cluster.getId())); hostOrchestrator.runService(gatewayConfigs, nodes, saltConfig, exitCriteriaModel); } catch (CloudbreakOrchestratorCancelledException e) { throw new CancellationException(e.getMessage()); } catch (CloudbreakOrchestratorException | IOException | CloudbreakException e) { throw new CloudbreakServiceException(e.getMessage(), e); } }  void runClusterServices(@Nonnull Stack stack, @Nonnull Cluster cluster, List<String> candidateAddresses); void updateClusterConfigs(@Nonnull Stack stack, @Nonnull Cluster cluster, List<String> candidateAddresses); Map<String, String> addClusterServices(Long stackId, String hostGroupName, Integer scalingAdjustment); String changePrimaryGateway(Stack stack); void redeployGatewayCertificate(@Nonnull Stack stack, @Nonnull Cluster cluster); Optional<String> decoratePillarWithClouderaManagerLicense(Long stackId, Map<String, SaltPillarProperties> servicePillar); void decoratePillarWithClouderaManagerRepo(ClouderaManagerRepo repo, Map<String, SaltPillarProperties> servicePillar, Optional<String> license); void decoratePillarWithClouderaManagerSettings(Map<String, SaltPillarProperties> servicePillar, ClouderaManagerRepo clouderaManagerRepo); }
ClusterHostServiceRunner { public void runClusterServices(@Nonnull Stack stack, @Nonnull Cluster cluster, List<String> candidateAddresses) { try { Set<Node> nodes = stackUtil.collectReachableNodes(stack); GatewayConfig primaryGatewayConfig = gatewayConfigService.getPrimaryGatewayConfig(stack); List<GatewayConfig> gatewayConfigs = gatewayConfigService.getAllGatewayConfigs(stack); SaltConfig saltConfig = createSaltConfig(stack, cluster, primaryGatewayConfig, gatewayConfigs, nodes); ExitCriteriaModel exitCriteriaModel = clusterDeletionBasedModel(stack.getId(), cluster.getId()); hostOrchestrator.initServiceRun(gatewayConfigs, nodes, saltConfig, exitCriteriaModel); if (CollectionUtils.isEmpty(candidateAddresses)) { mountDisks.mountAllDisks(stack.getId()); } else { mountDisks.mountDisksOnNewNodes(stack.getId(), new HashSet<>(candidateAddresses)); } recipeEngine.executePreClusterManagerRecipes(stack, hostGroupService.getRecipesByCluster(cluster.getId())); hostOrchestrator.runService(gatewayConfigs, nodes, saltConfig, exitCriteriaModel); } catch (CloudbreakOrchestratorCancelledException e) { throw new CancellationException(e.getMessage()); } catch (CloudbreakOrchestratorException | IOException | CloudbreakException e) { throw new CloudbreakServiceException(e.getMessage(), e); } }  void runClusterServices(@Nonnull Stack stack, @Nonnull Cluster cluster, List<String> candidateAddresses); void updateClusterConfigs(@Nonnull Stack stack, @Nonnull Cluster cluster, List<String> candidateAddresses); Map<String, String> addClusterServices(Long stackId, String hostGroupName, Integer scalingAdjustment); String changePrimaryGateway(Stack stack); void redeployGatewayCertificate(@Nonnull Stack stack, @Nonnull Cluster cluster); Optional<String> decoratePillarWithClouderaManagerLicense(Long stackId, Map<String, SaltPillarProperties> servicePillar); void decoratePillarWithClouderaManagerRepo(ClouderaManagerRepo repo, Map<String, SaltPillarProperties> servicePillar, Optional<String> license); void decoratePillarWithClouderaManagerSettings(Map<String, SaltPillarProperties> servicePillar, ClouderaManagerRepo clouderaManagerRepo);  }