use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings in project cloudbreak by hortonworks.
the class BlueprintBasedUpgradeValidatorTest method createImageFilterParams.
private ImageFilterParams createImageFilterParams(String blueprintName, StackType stackType) {
Blueprint blueprint = new Blueprint();
blueprint.setName(blueprintName);
return new ImageFilterParams(null, true, null, stackType, blueprint, null, new InternalUpgradeSettings(true, true, true), null);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings in project cloudbreak by hortonworks.
the class UpgradeConverterTest method testConvertRequestWhenInternal.
@Test
public void testConvertRequestWhenInternal() {
// GIVEN
DistroXUpgradeV1Request source = new DistroXUpgradeV1Request();
// WHEN
UpgradeV4Request result = underTest.convert(source, new InternalUpgradeSettings(true, true, true));
// THEN
assertTrue(result.getInternalUpgradeSettings().isSkipValidations());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings in project cloudbreak by hortonworks.
the class DistroXUpgradeV1ControllerTest method testDryRun.
@Test
public void testDryRun() {
DistroXUpgradeV1Request distroxUpgradeRequest = new DistroXUpgradeV1Request();
UpgradeV4Request upgradeV4Request = new UpgradeV4Request();
upgradeV4Request.setDryRun(Boolean.TRUE);
when(upgradeAvailabilityService.isRuntimeUpgradeEnabledByAccountId(ACCOUNT_ID)).thenReturn(true);
when(upgradeAvailabilityService.isOsUpgradeEnabledByAccountId(ACCOUNT_ID)).thenReturn(true);
when(upgradeConverter.convert(distroxUpgradeRequest, new InternalUpgradeSettings(false, true, true))).thenReturn(upgradeV4Request);
UpgradeV4Response upgradeV4Response = new UpgradeV4Response();
when(upgradeAvailabilityService.checkForUpgrade(NameOrCrn.ofName(CLUSTER_NAME), WORKSPACE_ID, upgradeV4Request, USER_CRN)).thenReturn(upgradeV4Response);
when(upgradeConverter.convert(upgradeV4Response)).thenReturn(new DistroXUpgradeV1Response());
ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.upgradeClusterByName(CLUSTER_NAME, distroxUpgradeRequest));
verify(upgradeAvailabilityService).checkForUpgrade(NameOrCrn.ofName(CLUSTER_NAME), WORKSPACE_ID, upgradeV4Request, USER_CRN);
verifyNoInteractions(upgradeService);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings in project cloudbreak by hortonworks.
the class DistroXUpgradeV1Controller method upgradeCluster.
private DistroXUpgradeV1Response upgradeCluster(String clusterNameOrCrn, DistroXUpgradeV1Request distroxUpgradeRequest, NameOrCrn nameOrCrn, InternalUpgradeSettings internalUpgradeSettings) {
String userCrn = ThreadBasedUserCrnProvider.getUserCrn();
UpgradeV4Request request = upgradeConverter.convert(distroxUpgradeRequest, internalUpgradeSettings);
Long workspaceId = restRequestThreadLocalService.getRequestedWorkspaceId();
if (request.isDryRun() || request.isShowAvailableImagesSet()) {
LOGGER.info("Checking for upgrade for cluster [{}] with request: {}", clusterNameOrCrn, request);
UpgradeV4Response upgradeV4Response = upgradeAvailabilityService.checkForUpgrade(nameOrCrn, workspaceId, request, userCrn);
return upgradeConverter.convert(upgradeV4Response);
} else {
LOGGER.info("Triggering upgrade for cluster [{}] with request: {}", clusterNameOrCrn, request);
UpgradeV4Response upgradeV4Response = upgradeService.triggerUpgrade(nameOrCrn, workspaceId, userCrn, request);
return upgradeConverter.convert(upgradeV4Response);
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings in project cloudbreak by hortonworks.
the class DistroXUpgradeV1Controller method upgradeClusterByCrnInternal.
@Override
@InternalOnly
public DistroXUpgradeV1Response upgradeClusterByCrnInternal(@ResourceCrn String clusterCrn, @Valid DistroXUpgradeV1Request distroxUpgradeRequest, @InitiatorUserCrn String initiatorUserCrn) {
NameOrCrn nameOrCrn = NameOrCrn.ofCrn(clusterCrn);
boolean dataHubRuntimeUpgradeEnabled = upgradeAvailabilityService.isRuntimeUpgradeEnabledByUserCrn(initiatorUserCrn);
boolean dataHubOsUpgradeEntitled = upgradeAvailabilityService.isOsUpgradeEnabledByUserCrn(initiatorUserCrn);
return upgradeCluster(clusterCrn, distroxUpgradeRequest, nameOrCrn, new InternalUpgradeSettings(true, dataHubRuntimeUpgradeEnabled, dataHubOsUpgradeEntitled));
}
Aggregations