if (cluster == null) {
logger.error("cluster " + clusterName + " does not exist");
throw BddException.NOT_FOUND("Cluster", clusterName);
}
SoftwareManager softwareManager =
getSoftwareManager(cluster.getAppManager());
// read distro and distroVersion from ClusterEntity and set to ClusterCreate
clusterCreate.setDistro(cluster.getDistro());
clusterCreate.setDistroVersion(cluster.getDistroVersion());
if (!CommonUtil.isBlank(cluster.getAdvancedProperties())) {
Gson gson = new Gson();
Map<String, String> advancedProperties =
gson.fromJson(cluster.getAdvancedProperties(), Map.class);
clusterCreate.setExternalHDFS(advancedProperties.get("ExternalHDFS"));
clusterCreate.setExternalMapReduce(advancedProperties
.get("ExternalMapReduce"));
clusterCreate.setLocalRepoURL(advancedProperties.get("LocalRepoURL"));
}
// only check roles validity in server side, but not in CLI and GUI, because roles info exist in server side.
ClusterBlueprint blueprint = clusterCreate.toBlueprint();
try {
softwareManager.validateBlueprint(blueprint);
} catch (ValidationException e) {
throw ClusterConfigException.INVALID_SPEC(e.getFailedMsgList());
}
updateInfrastructure(clusterCreate, softwareManager, blueprint);