Map<String, Integer> installRequests = ambariClient.installComponentsToHost(host, stack.getCluster().getBlueprint().getBlueprintName(), hostgroup);
LOGGER.info("Host added and service install requests are sent. [Ambari server: {}, host: '{}']", ambariIp, host);
return installRequests;
} catch (HttpResponseException e) {
if ("Conflict".equals(e.getMessage())) {
throw new BadRequestException("Host already exists.", e);
} else if ("Bad Request".equals(e.getMessage())) {
throw new BadRequestException("Failed to validate host.", e);
} else {
throw new InternalServerException("Something went wrong", e);
}
}
}