use of com.sequenceiq.cloudbreak.orchestrator.salt.domain.SaltMaster in project cloudbreak by hortonworks.
the class SaltBootstrap method createBootstrap.
private SaltAction createBootstrap() {
SaltAction saltAction = new SaltAction(SaltActionType.RUN);
SaltAuth auth = new SaltAuth();
auth.setPassword(sc.getSaltPassword());
List<String> targetIps = targets.stream().map(Node::getPrivateIp).collect(Collectors.toList());
for (GatewayConfig gatewayConfig : allGatewayConfigs) {
String gatewayAddress = gatewayConfig.getPrivateAddress();
if (targetIps.contains(gatewayAddress)) {
Node saltMaster = targets.stream().filter(n -> n.getPrivateIp().equals(gatewayAddress)).findFirst().get();
SaltMaster master = new SaltMaster();
master.setAddress(gatewayAddress);
master.setAuth(auth);
master.setDomain(saltMaster.getDomain());
master.setHostName(saltMaster.getHostname());
// set due to compatibility reasons
saltAction.setServer(gatewayAddress);
saltAction.setMaster(master);
saltAction.addMinion(createMinion(saltMaster));
saltAction.addMaster(master);
}
}
for (Node minion : targets.stream().filter(node -> !getGatewayPrivateIps().contains(node.getPrivateIp())).collect(Collectors.toList())) {
saltAction.addMinion(createMinion(minion));
}
return saltAction;
}
Aggregations