Source:
<code>public Action<?, ?> finishExtendMetadata() { return new AbstractStackUpscaleAction<>(CollectMetadataResult.class) { @Override protected void doExecute(StackScalingFlowContext context, CollectMetadataResult payload, Map<Object, Object> variables) throws TransactionExecutionException { Set<String> upscaleCandidateAddresses = stackUpscaleService.finishExtendMetadata(context.getStack(), context.getAdjustment(), payload); variables.put(UPSCALE_CANDIDATE_ADDRESSES, upscaleCandidateAddresses); InstanceGroup ig = instanceGroupService.findOneWithInstanceMetadataByGroupNameInStack(payload.getResourceId(), context.getInstanceGroupName()) .orElseThrow(NotFoundException.notFound("instanceGroup", context.getInstanceGroupName())); if (InstanceGroupType.GATEWAY == ig.getInstanceGroupType()) { Stack stack = stackService.getByIdWithListsInTransaction(context.getStack().getId()); InstanceMetaData gatewayMetaData = stack.getPrimaryGatewayInstance(); if (null == gatewayMetaData && isRepair(variables)) { <START> throw new CloudbreakServiceException("Could not get instance metadata from the cloud provider."); <END> } CloudInstance gatewayInstance = metadataConverter.convert(gatewayMetaData); Selectable sshFingerPrintReq = new GetSSHFingerprintsRequest<GetSSHFingerprintsResult>(context.getCloudContext(), context.getCloudCredential(), gatewayInstance); sendEvent(context, sshFingerPrintReq); } else { BootstrapNewNodesEvent bootstrapPayload = new BootstrapNewNodesEvent(context.getStack().getId()); sendEvent(context, StackUpscaleEvent.BOOTSTRAP_NEW_NODES_EVENT.event(), bootstrapPayload); } } }; }</code><technical_language>gateway metadata provider side</technical_language>

Target:
public Action<?, ?> finishExtendMetadata() { return new AbstractStackUpscaleAction<>(CollectMetadataResult.class) { @Override protected void doExecute(StackScalingFlowContext context, CollectMetadataResult payload, Map<Object, Object> variables) throws TransactionExecutionException { Set<String> upscaleCandidateAddresses = stackUpscaleService.finishExtendMetadata(context.getStack(), context.getAdjustment(), payload); variables.put(UPSCALE_CANDIDATE_ADDRESSES, upscaleCandidateAddresses); InstanceGroup ig = instanceGroupService.findOneWithInstanceMetadataByGroupNameInStack(payload.getResourceId(), context.getInstanceGroupName()) .orElseThrow(NotFoundException.notFound("instanceGroup", context.getInstanceGroupName())); if (InstanceGroupType.GATEWAY == ig.getInstanceGroupType()) { Stack stack = stackService.getByIdWithListsInTransaction(context.getStack().getId()); InstanceMetaData gatewayMetaData = stack.getPrimaryGatewayInstance(); if (null == gatewayMetaData && isRepair(variables)) { throw new CloudbreakServiceException("Could not get gateway instance metadata from the cloud provider."); } CloudInstance gatewayInstance = metadataConverter.convert(gatewayMetaData); Selectable sshFingerPrintReq = new GetSSHFingerprintsRequest<GetSSHFingerprintsResult>(context.getCloudContext(), context.getCloudCredential(), gatewayInstance); sendEvent(context, sshFingerPrintReq); } else { BootstrapNewNodesEvent bootstrapPayload = new BootstrapNewNodesEvent(context.getStack().getId()); sendEvent(context, StackUpscaleEvent.BOOTSTRAP_NEW_NODES_EVENT.event(), bootstrapPayload); } } }; }