use of com.yahoo.config.model.api.ModelCreateResult in project vespa by vespa-engine.
the class VespaModelFactoryTest method testThatFactoryModelValidationCanBeIgnored.
@Test
public void testThatFactoryModelValidationCanBeIgnored() {
VespaModelFactory modelFactory = new VespaModelFactory(new NullConfigModelRegistry());
ModelCreateResult createResult = modelFactory.createAndValidateModel(new MockModelContext(createApplicationPackageThatFailsWhenValidating()), true);
assertNotNull(createResult.getModel());
assertNotNull(createResult.getConfigChangeActions());
assertTrue(createResult.getConfigChangeActions().isEmpty());
}
use of com.yahoo.config.model.api.ModelCreateResult in project vespa by vespa-engine.
the class VespaModelFactory method createAndValidateModel.
@Override
public ModelCreateResult createAndValidateModel(ModelContext modelContext, boolean ignoreValidationErrors) {
validateXml(modelContext, ignoreValidationErrors);
DeployState deployState = createDeployState(modelContext, true);
VespaModel model = buildModel(deployState);
List<ConfigChangeAction> changeActions = validateModel(model, deployState, ignoreValidationErrors);
return new ModelCreateResult(model, changeActions);
}
use of com.yahoo.config.model.api.ModelCreateResult in project vespa by vespa-engine.
the class PreparedModelsBuilder method buildModelVersion.
@Override
protected PreparedModelResult buildModelVersion(ModelFactory modelFactory, ApplicationPackage applicationPackage, ApplicationId applicationId, com.yahoo.component.Version wantedNodeVespaVersion, Optional<AllocatedHosts> allocatedHosts, Instant now) {
Version modelVersion = modelFactory.getVersion();
log.log(LogLevel.DEBUG, "Building model " + modelVersion + " for " + applicationId);
FileDistributionProvider fileDistributionProvider = fileDistributionFactory.createProvider(context.getServerDBSessionDir());
// Use empty on non-hosted systems, use already allocated hosts if available, create connection to a host provisioner otherwise
Optional<HostProvisioner> hostProvisioner = createHostProvisioner(allocatedHosts);
Optional<Model> previousModel = currentActiveApplicationSet.map(set -> set.getForVersionOrLatest(Optional.of(modelVersion), now).getModel());
ModelContext modelContext = new ModelContextImpl(applicationPackage, previousModel, permanentApplicationPackage.applicationPackage(), logger, configDefinitionRepo, fileDistributionProvider.getFileRegistry(), hostProvisioner, properties, getAppDir(applicationPackage), new com.yahoo.component.Version(modelVersion.toString()), wantedNodeVespaVersion);
log.log(LogLevel.DEBUG, "Create and validate model " + modelVersion + " for " + applicationId);
ModelCreateResult result = modelFactory.createAndValidateModel(modelContext, params.ignoreValidationErrors());
validateModelHosts(context.getHostValidator(), applicationId, result.getModel());
log.log(LogLevel.DEBUG, "Done building model " + modelVersion + " for " + applicationId);
return new PreparedModelsBuilder.PreparedModelResult(modelVersion, result.getModel(), fileDistributionProvider, result.getConfigChangeActions());
}
Aggregations