use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class EditCanaryPrometheusCommand method executeThis.
@Override
protected void executeThis() {
String currentDeployment = getCurrentDeployment();
// Disable validation here, since we don't want an illegal config to prevent us from fixing it.
Canary canary = new OperationHandler<Canary>().setFailureMesssage("Failed to get canary.").setOperation(Daemon.getCanary(currentDeployment, false)).get();
int originalHash = canary.hashCode();
PrometheusCanaryServiceIntegration prometheusCanaryServiceIntegration = (PrometheusCanaryServiceIntegration) CanaryUtils.getServiceIntegrationByClass(canary, PrometheusCanaryServiceIntegration.class);
prometheusCanaryServiceIntegration.setMetadataCachingIntervalMS(isSet(metadataCachingIntervalMS) ? metadataCachingIntervalMS : prometheusCanaryServiceIntegration.getMetadataCachingIntervalMS());
if (originalHash == canary.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setOperation(Daemon.setCanary(currentDeployment, !noValidate, canary)).setFailureMesssage("Failed to edit canary analysis Prometheus service integration settings.").setSuccessMessage("Successfully edited canary analysis Prometheus service integration settings.").get();
}
use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class AbstractEnableDisableCanaryServiceIntegrationCommand method executeThis.
@Override
protected void executeThis() {
String currentDeployment = getCurrentDeployment();
// Disable validation here, since we don't want an illegal config to prevent us from fixing it.
Canary canary = new OperationHandler<Canary>().setFailureMesssage("Failed to get canary.").setOperation(Daemon.getCanary(currentDeployment, false)).get();
int originalHash = canary.hashCode();
AbstractCanaryServiceIntegration canaryServiceIntegration = CanaryUtils.getServiceIntegrationByName(canary, currentDeployment, getName(), true);
canaryServiceIntegration.setEnabled(isEnable());
if (originalHash == canary.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setSuccessMessage("Successfully " + indicativePastPerfectAction() + " canary analysis " + getName() + " service integration.").setFailureMesssage("Failed to " + getCommandName() + " canary analysis " + getName() + " service integration.").setOperation(Daemon.setCanary(currentDeployment, !noValidate, canary)).get();
}
use of com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler in project halyard by spinnaker.
the class EditCanaryCommand method executeThis.
@Override
protected void executeThis() {
String currentDeployment = getCurrentDeployment();
// Disable validation here, since we don't want an illegal config to prevent us from fixing it.
Canary canary = new OperationHandler<Canary>().setFailureMesssage("Failed to get canary.").setOperation(Daemon.getCanary(currentDeployment, false)).get();
int originalHash = canary.hashCode();
canary.setReduxLoggerEnabled(isSet(reduxLoggerEnabled) ? reduxLoggerEnabled : canary.isReduxLoggerEnabled());
canary.setDefaultMetricsAccount(isSet(defaultMetricsAccount) ? defaultMetricsAccount : canary.getDefaultMetricsAccount());
canary.setDefaultStorageAccount(isSet(defaultStorageAccount) ? defaultStorageAccount : canary.getDefaultStorageAccount());
canary.setDefaultJudge(isSet(defaultJudge) ? defaultJudge : canary.getDefaultJudge());
canary.setDefaultMetricsStore(isSet(defaultMetricsStore) ? defaultMetricsStore : canary.getDefaultMetricsStore());
canary.setStagesEnabled(isSet(stagesEnabled) ? stagesEnabled : canary.isStagesEnabled());
canary.setAtlasWebComponentsUrl(isSet(atlasWebComponentsUrl) ? atlasWebComponentsUrl : canary.getAtlasWebComponentsUrl());
canary.setTemplatesEnabled(isSet(templatesEnabled) ? templatesEnabled : canary.isTemplatesEnabled());
canary.setShowAllConfigsEnabled(isSet(showAllConfigsEnabled) ? showAllConfigsEnabled : canary.isShowAllConfigsEnabled());
if (originalHash == canary.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setOperation(Daemon.setCanary(currentDeployment, !noValidate, canary)).setFailureMesssage("Failed to edit canary analysis settings.").setSuccessMessage("Successfully edited canary analysis settings.").get();
}
Aggregations