use of com.netflix.spinnaker.halyard.config.model.v1.canary.prometheus.PrometheusCanaryServiceIntegration 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();
}
Aggregations