@Override public void validate(ConfigProblemSetBuilder p, DeploymentConfiguration n) { String timezone = n.getTimezone(); if (Arrays.stream(TimeZone.getAvailableIDs()).noneMatch(t -> t.equals(timezone))) { p.addProblem(Problem.Severity.ERROR, "Timezone " + timezone + " does not match any known canonical timezone ID") .setRemediation("Pick a timezone from those listed here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"); } }
@Override public void validate(ConfigProblemSetBuilder p, DeploymentConfiguration n) { String timezone = n.getTimezone(); if (Arrays.stream(TimeZone.getAvailableIDs()).noneMatch(t -> t.equals(timezone))) { p.addProblem(Problem.Severity.ERROR, "Timezone " + timezone + " does not match any known canonical timezone ID") .setRemediation("Pick a timezone from those listed here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"); } }
@Override protected void setProfile(Profile profile, DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) { profile.appendContents(yamlToString(endpoints.slim())); profile.appendContents("global.spinnaker.timezone: " + deploymentConfiguration.getTimezone()); }
bindings.put("timezone", deploymentConfiguration.getTimezone()); bindings.put("version", deploymentConfiguration.getVersion());
bindings.put("timezone", deploymentConfiguration.getTimezone()); bindings.put("version", deploymentConfiguration.getVersion());
@Override protected void setProfile(Profile profile, DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) { super.setProfile(profile, deploymentConfiguration, endpoints); List<String> files = new ArrayList<>(); profile.appendContents("global.spinnaker.timezone: " + deploymentConfiguration.getTimezone()); profile.appendContents("spinnaker.baseUrl: " + endpoints.getServiceSettings(Type.DECK).getBaseUrl()); Notifications notifications = deploymentConfiguration.getNotifications(); if (notifications != null) { files.addAll(backupRequiredFiles(notifications, deploymentConfiguration.getName())); profile.appendContents(yamlToString(notifications)); } Pubsubs pubsubs = deploymentConfiguration.getPubsub(); if (pubsubs != null) { files.addAll(backupRequiredFiles(pubsubs, deploymentConfiguration.getName())); profile.appendContents(yamlToString(new PubsubWrapper(pubsubs))); } profile.appendContents(profile.getBaseContents()) .setRequiredFiles(files); }
@Override protected void setProfile(Profile profile, DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) { super.setProfile(profile, deploymentConfiguration, endpoints); List<String> files = new ArrayList<>(); profile.appendContents("global.spinnaker.timezone: " + deploymentConfiguration.getTimezone()); profile.appendContents("spinnaker.baseUrl: " + endpoints.getServiceSettings(Type.DECK).getBaseUrl()); Notifications notifications = deploymentConfiguration.getNotifications(); if (notifications != null) { files.addAll(backupRequiredFiles(notifications, deploymentConfiguration.getName())); profile.appendContents(yamlToString(notifications)); } Pubsubs pubsubs = deploymentConfiguration.getPubsub(); if (pubsubs != null) { files.addAll(backupRequiredFiles(pubsubs, deploymentConfiguration.getName())); profile.appendContents(yamlToString(new PubsubWrapper(pubsubs))); } Artifacts artifacts = deploymentConfiguration.getArtifacts(); if (artifacts != null) { files.addAll(backupRequiredFiles(artifacts, deploymentConfiguration.getName())); profile.appendContents(yamlToString(new ArtifactWrapper(artifacts))); } profile.appendContents(profile.getBaseContents()) .setRequiredFiles(files); }
@Override protected void executeThis() { String currentDeployment = getCurrentDeployment(); DeploymentConfiguration deploymentConfiguration = new OperationHandler<DeploymentConfiguration>() .setOperation(Daemon.getDeploymentConfiguration(currentDeployment, false)) .setFailureMesssage("Failed to get your deployment configuration for edits.") .get(); int hash = deploymentConfiguration.hashCode(); deploymentConfiguration.setTimezone(isSet(timezone) ? timezone : deploymentConfiguration.getTimezone()); if (deploymentConfiguration.hashCode() == hash) { AnsiUi.error("No changes supplied."); return; } new OperationHandler<Void>() .setOperation(Daemon.setDeploymentConfiguration(currentDeployment, !noValidate, deploymentConfiguration)) .setFailureMesssage("Failed to apply edits to your deployment configuration") .setSuccessMessage("Successfully edited your deployment configuration") .get(); } }
@Override protected void executeThis() { String currentDeployment = getCurrentDeployment(); DeploymentConfiguration deploymentConfiguration = new OperationHandler<DeploymentConfiguration>() .setOperation(Daemon.getDeploymentConfiguration(currentDeployment, false)) .setFailureMesssage("Failed to get your deployment configuration for edits.") .get(); int hash = deploymentConfiguration.hashCode(); deploymentConfiguration.setTimezone(isSet(timezone) ? timezone : deploymentConfiguration.getTimezone()); if (deploymentConfiguration.hashCode() == hash) { AnsiUi.error("No changes supplied."); return; } new OperationHandler<Void>() .setOperation(Daemon.setDeploymentConfiguration(currentDeployment, !noValidate, deploymentConfiguration)) .setFailureMesssage("Failed to apply edits to your deployment configuration") .setSuccessMessage("Successfully edited your deployment configuration") .get(); } }