use of com.sequenceiq.cloudbreak.common.json.Json in project cloudbreak by hortonworks.
the class UserSyncService method asyncSynchronizeStack.
private Future<SyncStatusDetail> asyncSynchronizeStack(Stack stack, UmsUsersState umsUsersState, UmsEventGenerationIds umsEventGenerationIds, UserSyncOptions options, String operationId, String accountId) {
return asyncTaskExecutor.submit(() -> {
SyncStatusDetail statusDetail = internalSynchronizeStack(stack, umsUsersState, options);
if (options.isFullSync() && statusDetail.getStatus() == SynchronizationStatus.COMPLETED) {
UserSyncStatus userSyncStatus = userSyncStatusService.getOrCreateForStack(stack);
userSyncStatus.setUmsEventGenerationIds(new Json(umsEventGenerationIds));
userSyncStatus.setLastSuccessfulFullSync(operationService.getOperationForAccountIdAndOperationId(accountId, operationId));
userSyncStatusService.save(userSyncStatus);
}
return statusDetail;
});
}
use of com.sequenceiq.cloudbreak.common.json.Json in project cloudbreak by hortonworks.
the class UserSyncStatusService method getOrCreateForStack.
public UserSyncStatus getOrCreateForStack(Stack stack) {
return userSyncStatusRepository.getByStack(stack).orElseGet(() -> {
UserSyncStatus userSyncStatus = new UserSyncStatus();
userSyncStatus.setStack(stack);
userSyncStatus.setUmsEventGenerationIds(new Json(new UmsEventGenerationIds()));
return userSyncStatusRepository.save(userSyncStatus);
});
}
use of com.sequenceiq.cloudbreak.common.json.Json in project cloudbreak by hortonworks.
the class SshJClientActions method checkNoEphemeralDisksMounted.
public void checkNoEphemeralDisksMounted(List<InstanceGroupV4Response> instanceGroups, List<String> hostGroupNames) {
Map<String, Pair<Integer, String>> deviceMountPointMappingsByIp = getDeviceMountPointMappingsByIp(instanceGroups, hostGroupNames);
Map<String, Pair<Integer, String>> deviceDiskTypeMappingsByIp = getDeviceDiskTypeMappingsByIp(instanceGroups, hostGroupNames);
for (Entry<String, Pair<Integer, String>> node : deviceDiskTypeMappingsByIp.entrySet()) {
Map<String, String> ephemeralDisks = new Json(node.getValue().getValue()).getMap().entrySet().stream().filter(e -> String.valueOf(e.getValue()).contains("Amazon EC2 NVMe Instance Storage")).collect(Collectors.toMap(Entry::getKey, x -> String.valueOf(x.getValue())));
if (!ephemeralDisks.isEmpty()) {
LOGGER.error("Instance store volume unintentionally present on node with IP {}!", node.getKey());
throw new TestFailException(String.format("Instance store volume unintentionally present on node with IP %s!", node.getKey()));
}
}
for (Entry<String, Pair<Integer, String>> node : deviceMountPointMappingsByIp.entrySet()) {
Map<String, String> ephemeralMounts = new Json(node.getValue().getValue()).getMap().entrySet().stream().filter(e -> String.valueOf(e.getValue()).contains("ephfs")).collect(Collectors.toMap(Entry::getKey, x -> String.valueOf(x.getValue())));
if (!ephemeralMounts.isEmpty()) {
LOGGER.error("Device incorrectly mounted to /hadoopfs/ephfsN on node with IP {}!", node.getKey());
throw new TestFailException(String.format("Device incorrectly mounted to /hadoopfs/ephfsN on node with IP %s!", node.getKey()));
}
}
}
use of com.sequenceiq.cloudbreak.common.json.Json in project cloudbreak by hortonworks.
the class ClusterToClusterV4ResponseConverter method convertCustomQueue.
private void convertCustomQueue(Cluster source, ClusterV4Response clusterResponse) {
if (source.getAttributes() != null) {
Json fromVault = new Json(source.getAttributes());
Map<String, Object> attributes = fromVault.getMap();
Object customQueue = attributes.get(CUSTOM_QUEUE.name());
if (customQueue != null) {
clusterResponse.setCustomQueue(customQueue.toString());
} else {
clusterResponse.setCustomQueue("default");
}
}
}
use of com.sequenceiq.cloudbreak.common.json.Json in project cloudbreak by hortonworks.
the class ClusterToClusterV4ResponseConverter method convertNullableProperties.
private void convertNullableProperties(Cluster source, ClusterV4Response clusterResponse) {
if (source.getGateway() != null) {
GatewayV4Response gatewayV4Response = gatewayToGatewayV4ResponseConverter.convert(source.getGateway());
clusterResponse.setGateway(gatewayV4Response);
}
if (source.getAttributes() != null) {
Json fromVault = new Json(source.getAttributes());
clusterResponse.setAttributes(fromVault.getMap());
}
}
Aggregations