Skip to content

Commit

Permalink
fix(front50): Remove duplicate spinnaker key (#1662)
Browse files Browse the repository at this point in the history
* feat(telemetry): code formatting

* fix(plugins): removing extra spinnaker key

* fix(front50): fix nesting of persistent storage configs

Co-authored-by: Cristhian Castaneda <cristhian.castaneda@armory.io>
  • Loading branch information
link108 and Cristhian Castaneda authored May 14, 2020
1 parent e156622 commit 03c4d6f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.SpinnakerService.Type;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -65,10 +64,14 @@ public void setProfile(
throw new HalException(Problem.Severity.FATAL, "No persistent storage type was configured.");
}

Map<String, Object> spinnakerYaml =
spinnakerVersionSupportsPlugins(deploymentConfiguration.getVersion())
? getSpinnakerYaml(deploymentConfiguration)
: new LinkedHashMap<>();
Map<String, Map<String, Object>> spinnakerYaml;
if (spinnakerVersionSupportsPlugins(deploymentConfiguration.getVersion())) {
spinnakerYaml = getSpinnakerYaml(deploymentConfiguration);
} else {
spinnakerYaml = new LinkedHashMap<>();
spinnakerYaml.put("spinnaker", new LinkedHashMap<>());
}

List<String> files = backupRequiredFiles(persistentStorage, deploymentConfiguration.getName());

NodeIterator children = persistentStorage.getChildren();
Expand Down Expand Up @@ -96,19 +99,15 @@ public void setProfile(
persistentStoreMap.put(
"enabled", persistentStoreType.equals(persistentStorage.getPersistentStoreType()));

spinnakerYaml.put(persistentStoreType.getId(), persistentStoreMap);
spinnakerYaml.get("spinnaker").put(persistentStoreType.getId(), persistentStoreMap);
}

child = children.getNext();
}

Map<String, Object> spinnakerObjectMap = new HashMap<>();
spinnakerObjectMap.put("spinnaker", spinnakerYaml);

super.setProfile(profile, deploymentConfiguration, endpoints);
profile
.appendContents(
yamlToString(deploymentConfiguration.getName(), profile, spinnakerObjectMap))
.appendContents(yamlToString(deploymentConfiguration.getName(), profile, spinnakerYaml))
.appendContents(profile.getBaseContents())
.setRequiredFiles(files);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ protected void setProfile(
}
}

protected Map<String, Object> getSpinnakerYaml(DeploymentConfiguration deploymentConfiguration) {
Map<String, Object> spinnakerYaml = new LinkedHashMap<>();
protected Map<String, Map<String, Object>> getSpinnakerYaml(
DeploymentConfiguration deploymentConfiguration) {
Map<String, Map<String, Object>> spinnakerYaml = new LinkedHashMap<>();
Map<String, Object> extensibilityYaml = new LinkedHashMap<>();
Map<String, Object> extensibilityContents =
deploymentConfiguration.getSpinnaker().getExtensibility().toMap();
Expand Down

0 comments on commit 03c4d6f

Please sign in to comment.