use of com.sequenceiq.cloudbreak.orchestrator.salt.domain.Minion in project cloudbreak by hortonworks.
the class SaltBootstrap method createMinion.
private Minion createMinion(Node node) {
Minion minion = new Minion();
minion.setAddress(node.getPrivateIp());
minion.setHostGroup(node.getHostGroup());
minion.setHostName(node.getHostname());
minion.setDomain(node.getDomain());
minion.setServers(getGatewayPrivateIps());
// set due to compatibility reasons
minion.setServer(getGatewayPrivateIps().get(0));
return minion;
}
use of com.sequenceiq.cloudbreak.orchestrator.salt.domain.Minion 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;
}
use of com.sequenceiq.cloudbreak.orchestrator.salt.domain.Minion in project cloudbreak by hortonworks.
the class SaltStates method stopMinions.
public static void stopMinions(SaltConnector sc, Map<String, String> privateIPsByFQDN) {
SaltAction saltAction = new SaltAction(SaltActionType.STOP);
for (Entry<String, String> entry : privateIPsByFQDN.entrySet()) {
Minion minion = new Minion();
minion.setAddress(entry.getValue());
saltAction.addMinion(minion);
}
sc.action(saltAction);
}
Aggregations