use of com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException 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.error.v1.ConfigNotFoundException 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());
}
}
use of com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException in project halyard by spinnaker.
the class PubsubService method getAllPubsubs.
public List<Pubsub> getAllPubsubs(String deploymentName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).withAnyPubsub();
List<Pubsub> matching = lookupService.getMatchingNodesOfType(filter, Pubsub.class);
if (matching.size() == 0) {
throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No pubsubs could be found").build());
} else {
return matching;
}
}
use of com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException in project halyard by spinnaker.
the class DeploymentEnvironmentValidator method validateDistributedDeployment.
private void validateDistributedDeployment(ConfigProblemSetBuilder p, DeploymentEnvironment n) {
String accountName = n.getAccountName();
if (StringUtils.isEmpty(accountName)) {
p.addProblem(Problem.Severity.FATAL, "An account name must be specified when using a Distributed deployment.");
return;
}
DeploymentConfiguration deploymentConfiguration = n.parentOfType(DeploymentConfiguration.class);
Account account;
try {
account = accountService.getAnyProviderAccount(deploymentConfiguration.getName(), n.getAccountName());
} catch (ConfigNotFoundException e) {
p.addProblem(Problem.Severity.FATAL, "Account " + accountName + " not defined.");
return;
}
if (account instanceof GoogleAccount) {
p.addProblem(Problem.Severity.WARNING, "Support for distributed deployments on GCE aren't fully supported yet.");
} else if (account instanceof KubernetesAccount) {
kubernetesAccountValidator.ensureKubectlExists(p);
} else {
p.addProblem(Problem.Severity.FATAL, "Account " + accountName + " is not in a provider that supports distributed installation of Spinnaker yet");
}
}
Aggregations