Source:
<code>public void createUserData(Long stackId) throws CloudbreakImageNotFoundException { Stack stack = stackService.getByIdWithLists(stackId); String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); Future<PlatformParameters> platformParametersFuture = intermediateBuilderExecutor.submit(() -> connector.getPlatformParameters(stack, userCrn)); SecurityConfig securityConfig = securityConfigService.generateAndSaveSecurityConfig(stack); stack.setSecurityConfig(securityConfig); stackService.save(stack); SaltSecurityConfig saltSecurityConfig = securityConfig.getSaltSecurityConfig(); String cbPrivKey = saltSecurityConfig.getSaltBootSignPrivateKey(); byte[] cbSshKeyDer = PkiUtil.getPublicKeyDer(new String(Base64.decodeBase64(cbPrivKey))); String sshUser = stack.getStackAuthentication().getLoginUserName(); String cbCert = securityConfig.getClientCert(); String saltBootPassword = saltSecurityConfig.getSaltBootPassword(); try { PlatformParameters platformParameters = platformParametersFuture.get(); CcmConnectivityParameters ccmParameters = fetchCcmParameters(stack); Optional<ProxyConfig> proxyConfig = proxyConfigDtoService.getByEnvironmentCrn(stack.getEnvironmentCrn()); Map<InstanceGroupType, String> userData = userDataBuilder.buildUserData(Platform.platform(stack.getCloudPlatform()), cbSshKeyDer, sshUser, platformParameters, saltBootPassword, cbCert, ccmParameters, proxyConfig.orElse(null)); imageService.decorateImageWithUserDataForStack(stack, userData); <START> saveStackCCMParameters(stack, ccmParameters); <END> } catch (InterruptedException | ExecutionException e) { LOGGER.error("Failed to get Platform parmaters", e); throw new GetCloudParameterException("Failed to get Platform parmaters", e); } }</code><technical_language>if move save next fetch, moved out handled together. save some if condition checking if CCMv1 v2</technical_language>

Target:
public void createUserData(Long stackId) throws CloudbreakImageNotFoundException { Stack stack = stackService.getByIdWithLists(stackId); String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); Future<PlatformParameters> platformParametersFuture = intermediateBuilderExecutor.submit(() -> connector.getPlatformParameters(stack, userCrn)); SecurityConfig securityConfig = securityConfigService.generateAndSaveSecurityConfig(stack); stack.setSecurityConfig(securityConfig); stackService.save(stack); SaltSecurityConfig saltSecurityConfig = securityConfig.getSaltSecurityConfig(); String cbPrivKey = saltSecurityConfig.getSaltBootSignPrivateKey(); byte[] cbSshKeyDer = PkiUtil.getPublicKeyDer(new String(Base64.decodeBase64(cbPrivKey))); String sshUser = stack.getStackAuthentication().getLoginUserName(); String cbCert = securityConfig.getClientCert(); String saltBootPassword = saltSecurityConfig.getSaltBootPassword(); try { PlatformParameters platformParameters = platformParametersFuture.get(); CcmConnectivityParameters ccmParameters = ccmUserDataService.fetchAndSaveCcmParameters(stack); Optional<ProxyConfig> proxyConfig = proxyConfigDtoService.getByEnvironmentCrn(stack.getEnvironmentCrn()); Map<InstanceGroupType, String> userData = userDataBuilder.buildUserData(Platform.platform(stack.getCloudPlatform()), cbSshKeyDer, sshUser, platformParameters, saltBootPassword, cbCert, ccmParameters, proxyConfig.orElse(null)); imageService.decorateImageWithUserDataForStack(stack, userData); } catch (InterruptedException | ExecutionException e) { LOGGER.error("Failed to get Platform parmaters", e); throw new GetCloudParameterException("Failed to get Platform parmaters", e); } }