use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter in project halyard by spinnaker.
the class CiService method getAllCis.
public List<Ci> getAllCis(String deploymentName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).withAnyCi();
List<Ci> matching = lookupService.getMatchingNodesOfType(filter, Ci.class);
if (matching.size() == 0) {
throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No cis could be found").build());
} else {
return matching;
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter in project halyard by spinnaker.
the class CiService method getCi.
public Ci getCi(String deploymentName, String ciName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setCi(ciName);
List<Ci> matching = lookupService.getMatchingNodesOfType(filter, Ci.class);
switch(matching.size()) {
case 0:
throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No Continuous Integration service with name \"" + ciName + "\" could be found").build());
case 1:
return matching.get(0);
default:
throw new IllegalConfigException(new ConfigProblemBuilder(Severity.FATAL, "More than one CI with name \"" + ciName + "\" found").build());
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter in project halyard by spinnaker.
the class MasterService method getAllMasters.
public List<Master> getAllMasters(String deploymentName, String ciName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setCi(ciName).withAnyMaster();
List<Master> matchingMasters = lookupService.getMatchingNodesOfType(filter, Master.class);
if (matchingMasters.size() == 0) {
throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No masters could be found").build());
} else {
return matchingMasters;
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter in project halyard by spinnaker.
the class RoscoProfileFactory method setProfile.
@Override
protected void setProfile(Profile profile, DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) {
super.setProfile(profile, deploymentConfiguration, endpoints);
Providers providers = deploymentConfiguration.getProviders();
Providers otherProviders = getImageProviders(profile.getVersion());
NodeIterator iterator = providers.getChildren();
Provider child = (Provider) iterator.getNext();
while (child != null) {
if (child instanceof HasImageProvider) {
NodeIterator otherIterator = otherProviders.getChildren();
NodeFilter providerFilter = new NodeFilter().setProvider(child.getNodeName());
HasImageProvider otherChild = (HasImageProvider) otherIterator.getNext(providerFilter);
if (otherChild == null) {
log.warn("images.yml has no images stored for " + child.getNodeName());
} else {
log.info("Adding default images for " + child.getNodeName());
((HasImageProvider) child).getBakeryDefaults().addDefaultImages(otherChild.getBakeryDefaults().getBaseImages());
}
}
child = (Provider) iterator.getNext();
}
List<String> files = backupRequiredFiles(providers, deploymentConfiguration.getName());
profile.appendContents(yamlToString(providers)).appendContents(profile.getBaseContents()).setRequiredFiles(files);
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter 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;
}
}
Aggregations