if (isConfigured(cluster)) {
return;
}
apiResourceRootV6.getClouderaManagerResource().updateConfig(
new ApiConfigList(Arrays.asList(new ApiConfig[]{new ApiConfig("PARCEL_UPDATE_FREQ", "1")})));
final Set<String> repositoriesRequired = new HashSet<String>();
for (CmServiceDef serviceDef : cluster.getServices()) {
repositoriesRequired.add(serviceDef.getType().getRepository().toString(cluster.getVersion()));
}
logger.info("parcel repo required: " + repositoriesRequired + " cluster: " + cluster.getName());
final List<String> repositoriesRequiredOrdered = new ArrayList<String>();
for (String repository : repositoriesRequired) {
if (repository.equals(Constants.CDH_REPO_PREFIX)) {
repositoriesRequiredOrdered.add(0, repository);
} else {
repositoriesRequiredOrdered.add(repository);
}
}
// validate this cluster has access to all Parcels it requires
executeAndReport("Validating parcels availability", addedNodes, null, ProgressSplit.VALIDATE_PARCELS_AVAILABILITY.getProgress(),
cluster.getCurrentReport(), reportQueue, new StatusPoller() {
@Override
public boolean poll() {
for (ApiParcel parcel : apiResourceRootV6.getClustersResource().getParcelsResource(cluster.getName())
.readParcels(DataView.FULL).getParcels()) {
try {
repositoriesRequired.remove(parcel.getProduct());
} catch (IllegalArgumentException e) {
// ignore
}
}
// TODO: if one required parcel is not available, will run forever, need timeout/validation
return repositoriesRequired.isEmpty();
}
}, false);
apiResourceRootV6.getClouderaManagerResource().updateConfig(
new ApiConfigList(Arrays.asList(new ApiConfig[]{new ApiConfig("PARCEL_UPDATE_FREQ", "60")})));
DefaultArtifactVersion expectVersion = null;
if (cluster.getFullVersion() != null) {
expectVersion = new DefaultArtifactVersion(cluster.getFullVersion());
}