use of com.netflix.spinnaker.halyard.config.model.v1.node.Halconfig in project halyard by spinnaker.
the class BackupService method restore.
public void restore(String backupTar) {
String halconfigDir = directoryStructure.getHalconfigDirectory();
untarHalconfig(halconfigDir, backupTar);
Halconfig halconfig = halconfigParser.getHalconfig();
halconfig.makeLocalFilesAbsolute(halconfigDir);
halconfigParser.saveConfig();
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Halconfig in project halyard by spinnaker.
the class DeploymentService method setDeploymentConfiguration.
public void setDeploymentConfiguration(String deploymentName, DeploymentConfiguration deploymentConfiguration) {
Halconfig halconfig = halconfigParser.getHalconfig();
List<DeploymentConfiguration> deploymentConfigurations = halconfig.getDeploymentConfigurations();
int matchingIndex = -1;
for (int i = 0; i < deploymentConfigurations.size(); i++) {
DeploymentConfiguration test = deploymentConfigurations.get(i);
if (test.getName().equals(deploymentName)) {
matchingIndex = i;
break;
}
}
if (matchingIndex < 0) {
throw new HalException(Severity.FATAL, "Could not find a deployment with name " + deploymentName);
} else {
deploymentConfigurations.set(matchingIndex, deploymentConfiguration);
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Halconfig in project halyard by spinnaker.
the class DeploymentService method getAllDeploymentConfigurations.
public List<DeploymentConfiguration> getAllDeploymentConfigurations() {
NodeFilter filter = new NodeFilter().withAnyDeployment();
List<DeploymentConfiguration> matching = lookupService.getMatchingNodesOfType(filter, DeploymentConfiguration.class);
if (matching.size() == 0) {
throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No deployments could be found in your currently loaded halconfig").build());
} else {
return matching;
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Halconfig in project halyard by spinnaker.
the class DeploymentService method getDeploymentConfiguration.
public DeploymentConfiguration getDeploymentConfiguration(String deploymentName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName);
List<DeploymentConfiguration> matching = lookupService.getMatchingNodesOfType(filter, DeploymentConfiguration.class);
switch(matching.size()) {
case 0:
throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No deployment with name \"" + deploymentName + "\" could be found").setRemediation("Create a new deployment with name \"" + deploymentName + "\"").build());
case 1:
return matching.get(0);
default:
throw new IllegalConfigException(new ConfigProblemBuilder(Severity.FATAL, "More than one deployment with name \"" + deploymentName + "\" found").setRemediation("Manually delete or rename duplicate deployments with name \"" + deploymentName + "\" in your halconfig file").build());
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Halconfig in project halyard by spinnaker.
the class ArtifactProviderService method getArtifactProvider.
public ArtifactProvider getArtifactProvider(String deploymentName, String providerName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setArtifactProvider(providerName);
List<ArtifactProvider> matching = lookupService.getMatchingNodesOfType(filter, ArtifactProvider.class);
switch(matching.size()) {
case 0:
throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No provider with name \"" + providerName + "\" could be found").setRemediation("Create a new provider with name \"" + providerName + "\"").build());
case 1:
return matching.get(0);
default:
throw new IllegalConfigException(new ConfigProblemBuilder(Severity.FATAL, "More than one provider with name \"" + providerName + "\" found").setRemediation("Manually delete or rename duplicate providers with name \"" + providerName + "\" in your halconfig file").build());
}
}
Aggregations