From 1e413aa12770e3bfd994ba7742bdb4bfe6f4fe02 Mon Sep 17 00:00:00 2001 From: Lars Wander Date: Thu, 8 Jun 2017 14:36:41 -0400 Subject: [PATCH] fix(validation): Static updates were reporting duplicate errors --- .../halyard/core/DaemonResponse.java | 6 +++++ .../v1/{dcos => }/ClusterController.java | 22 +++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) rename halyard-web/src/main/java/com/netflix/spinnaker/halyard/controllers/v1/{dcos => }/ClusterController.java (91%) diff --git a/halyard-core/src/main/java/com/netflix/spinnaker/halyard/core/DaemonResponse.java b/halyard-core/src/main/java/com/netflix/spinnaker/halyard/core/DaemonResponse.java index ba50c55061..f98474c26f 100644 --- a/halyard-core/src/main/java/com/netflix/spinnaker/halyard/core/DaemonResponse.java +++ b/halyard-core/src/main/java/com/netflix/spinnaker/halyard/core/DaemonResponse.java @@ -112,6 +112,12 @@ public DaemonResponse build() { problemSet = validateResponse.get(); } problemSet.throwifSeverityExceeds(severity); + } catch (Exception e) { + log.error("Unknown exception encountered: ", e); + throw e; + } + + try { responseBody = buildResponse.get(); } catch (HalException e) { // This is OK, propagate the exception to the HalconfigExceptionHandler diff --git a/halyard-web/src/main/java/com/netflix/spinnaker/halyard/controllers/v1/dcos/ClusterController.java b/halyard-web/src/main/java/com/netflix/spinnaker/halyard/controllers/v1/ClusterController.java similarity index 91% rename from halyard-web/src/main/java/com/netflix/spinnaker/halyard/controllers/v1/dcos/ClusterController.java rename to halyard-web/src/main/java/com/netflix/spinnaker/halyard/controllers/v1/ClusterController.java index cc6d6e36ea..1f6e8f8007 100644 --- a/halyard-web/src/main/java/com/netflix/spinnaker/halyard/controllers/v1/dcos/ClusterController.java +++ b/halyard-web/src/main/java/com/netflix/spinnaker/halyard/controllers/v1/ClusterController.java @@ -1,4 +1,22 @@ -package com.netflix.spinnaker.halyard.controllers.v1.dcos; +/* + * Copyright 2017 Google, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License") + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package com.netflix.spinnaker.halyard.controllers.v1; import com.fasterxml.jackson.databind.ObjectMapper; import com.netflix.spinnaker.halyard.config.config.v1.HalconfigParser; @@ -25,7 +43,7 @@ import java.util.function.Supplier; /** - * Controller for adding clusters to the DC/OS provider + * Controller for adding clusters to a provider */ @RestController @RequestMapping("/v1/config/deployments/{deploymentName:.+}/providers/{providerName:.+}/clusters")