public ConfigValues getConfigValues() { if (configValues == null) { return new ConfigValues(); } else { return configValues; } }
public ConfigValues getConfigValues() { if (configValues == null) { return new ConfigValues(); } else { return configValues; } }
private ConfigValues loadConfigValues(File file) { ConfigValues configValues = new ConfigValues(); try { configValues.setRaw(new String(Files.readAllBytes(file.toPath()), "UTF-8")); } catch (IOException e) { throw new SkipperException("Could read values file " + file.getAbsoluteFile(), e); } return configValues; }
private ConfigValues loadConfigValues(File file) { ConfigValues configValues = new ConfigValues(); try { configValues.setRaw(new String(Files.readAllBytes(file.toPath()), "UTF-8")); } catch (IOException e) { throw new SkipperException("Could read values file " + file.getAbsoluteFile(), e); } return configValues; }
@PostLoad public void afterLoad() { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); try { this.pkg = mapper.readValue(this.pkgJsonString, Package.class); this.configValues = new ConfigValues(); if (this.configValuesString != null && StringUtils.hasText(configValuesString)) { this.configValues.setRaw(this.configValuesString); } } catch (IOException e) { throw new SkipperException("Error processing config values", e); } } }
@PostLoad public void afterLoad() { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); try { this.pkg = mapper.readValue(this.pkgJsonString, Package.class); this.configValues = new ConfigValues(); if (this.configValuesString != null && StringUtils.hasText(configValuesString)) { this.configValues.setRaw(this.configValuesString); } } catch (IOException e) { throw new SkipperException("Error processing config values", e); } } }
private InstallProperties getInstallProperties(String releaseName, String platformName, File yamlFile, String propertiesToOverride) throws IOException { InstallProperties installProperties = new InstallProperties(); if (StringUtils.hasText(releaseName)) { installProperties.setReleaseName(releaseName); } // There is a 'default' value for platformName installProperties.setPlatformName(platformName); String configValuesYML = YmlUtils.getYamlConfigValues(yamlFile, propertiesToOverride); if (StringUtils.hasText(configValuesYML)) { ConfigValues configValues = new ConfigValues(); configValues.setRaw(configValuesYML); installProperties.setConfigValues(configValues); } return installProperties; }
private Release updateReplacingReleaseConfigValues(Release targetRelease, Release replacingRelease) { Map<String, Object> targetConfigValueMap = getConfigValuesAsMap(targetRelease.getConfigValues()); Map<String, Object> replacingRelaseConfigValueMap = getConfigValuesAsMap(replacingRelease.getConfigValues()); if (targetConfigValueMap != null && replacingRelaseConfigValueMap != null) { ConfigValueUtils.merge(targetConfigValueMap, replacingRelaseConfigValueMap); DumperOptions dumperOptions = new DumperOptions(); dumperOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); dumperOptions.setPrettyFlow(true); Yaml yaml = new Yaml(dumperOptions); ConfigValues mergedConfigValues = new ConfigValues(); mergedConfigValues.setRaw(yaml.dump(targetConfigValueMap)); replacingRelease.setConfigValues(mergedConfigValues); } return replacingRelease; }
private Release updateReplacingReleaseConfigValues(Release targetRelease, Release replacingRelease) { Map<String, Object> targetConfigValueMap = getConfigValuesAsMap(targetRelease.getConfigValues()); Map<String, Object> replacingRelaseConfigValueMap = getConfigValuesAsMap(replacingRelease.getConfigValues()); if (targetConfigValueMap != null && replacingRelaseConfigValueMap != null) { ConfigValueUtils.merge(targetConfigValueMap, replacingRelaseConfigValueMap); DumperOptions dumperOptions = new DumperOptions(); dumperOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); dumperOptions.setPrettyFlow(true); Yaml yaml = new Yaml(dumperOptions); ConfigValues mergedConfigValues = new ConfigValues(); mergedConfigValues.setRaw(yaml.dump(targetConfigValueMap)); replacingRelease.setConfigValues(mergedConfigValues); } return replacingRelease; }
ConfigValues configValues = new ConfigValues(); Map<String, Object> configValueMap = new HashMap<>(); Map<String, Object> metadataMap = new HashMap<>();
ConfigValues configValues = new ConfigValues(); Map<String, Object> configValueMap = new HashMap<>(); Map<String, Object> metadataMap = new HashMap<>();
installProperties.setPlatformName(platformName); installProperties.setReleaseName(streamName); installProperties.setConfigValues(new ConfigValues()); installRequest.setInstallProperties(installProperties); Release release = null;
installProperties.setPlatformName(platformName); installProperties.setReleaseName(streamName); installProperties.setConfigValues(new ConfigValues()); installRequest.setInstallProperties(installProperties); Release release = null;
private UpgradeRequest getUpgradeRequest(String releaseName, String packageName, String packageVersion, File propertiesFile, String propertiesToOverride, String timeoutExpression, boolean forceUpgrade, String appNames) throws IOException { UpgradeRequest upgradeRequest = new UpgradeRequest(); upgradeRequest.setForce(forceUpgrade); upgradeRequest.setAppNames(new ArrayList<>(StringUtils.commaDelimitedListToSet(appNames))); UpgradeProperties upgradeProperties = new UpgradeProperties(); upgradeProperties.setReleaseName(releaseName); String configValuesYML = YmlUtils.getYamlConfigValues(propertiesFile, propertiesToOverride); if (StringUtils.hasText(configValuesYML)) { ConfigValues configValues = new ConfigValues(); configValues.setRaw(configValuesYML); upgradeProperties.setConfigValues(configValues); } upgradeRequest.setUpgradeProperties(upgradeProperties); PackageIdentifier packageIdentifier = new PackageIdentifier(); packageIdentifier.setPackageName(packageName); packageIdentifier.setPackageVersion(packageVersion); upgradeRequest.setPackageIdentifier(packageIdentifier); upgradeRequest.setPackageIdentifier(packageIdentifier); Duration duration = DurationUtils.convert(timeoutExpression); if (duration != null) { upgradeRequest.setTimeout(duration.toMillis()); } return upgradeRequest; }
/** * Update the stream identified by the PackageIdentifier and runtime configuration values. * @param streamName the name of the stream to upgrade * @param packageIdentifier the name of the package in skipper * @param configYml the YML formatted configuration values to use when upgrading * @param force the flag to indicate if the stream update is forced even if there are no differences from the existing stream * @param appNames the app names to update * @return release the upgraded release */ public Release upgradeStream(String streamName, PackageIdentifier packageIdentifier, String configYml, boolean force, List<String> appNames) { UpgradeRequest upgradeRequest = new UpgradeRequest(); upgradeRequest.setPackageIdentifier(packageIdentifier); UpgradeProperties upgradeProperties = new UpgradeProperties(); ConfigValues configValues = new ConfigValues(); configValues.setRaw(configYml); upgradeProperties.setConfigValues(configValues); upgradeProperties.setReleaseName(streamName); upgradeRequest.setUpgradeProperties(upgradeProperties); upgradeRequest.setForce(force); upgradeRequest.setAppNames(appNames); return this.skipperClient.upgrade(upgradeRequest); }
/** * Update the stream identified by the PackageIdentifier and runtime configuration values. * @param streamName the name of the stream to upgrade * @param packageIdentifier the name of the package in skipper * @param configYml the YML formatted configuration values to use when upgrading * @param force the flag to indicate if the stream update is forced even if there are no differences from the existing stream * @param appNames the app names to update * @return release the upgraded release */ public Release upgradeStream(String streamName, PackageIdentifier packageIdentifier, String configYml, boolean force, List<String> appNames) { UpgradeRequest upgradeRequest = new UpgradeRequest(); upgradeRequest.setPackageIdentifier(packageIdentifier); UpgradeProperties upgradeProperties = new UpgradeProperties(); ConfigValues configValues = new ConfigValues(); configValues.setRaw(configYml); upgradeProperties.setConfigValues(configValues); upgradeProperties.setReleaseName(streamName); upgradeRequest.setUpgradeProperties(upgradeProperties); upgradeRequest.setForce(force); upgradeRequest.setAppNames(appNames); return this.skipperClient.upgrade(upgradeRequest); }