Search in sources :

Example 1 with ConfigChangeActions

use of com.yahoo.vespa.config.server.configchange.ConfigChangeActions in project vespa by vespa-engine.

the class ApplicationRepository method prepare.

public PrepareResult prepare(Tenant tenant, long sessionId, PrepareParams prepareParams, Instant now) {
    validateThatLocalSessionIsNotActive(tenant, sessionId);
    LocalSession session = getLocalSession(tenant, sessionId);
    ApplicationId applicationId = prepareParams.getApplicationId();
    Optional<ApplicationSet> currentActiveApplicationSet = getCurrentActiveApplicationSet(tenant, applicationId);
    Slime deployLog = createDeployLog();
    DeployLogger logger = new DeployHandlerLogger(deployLog.get().setArray("log"), prepareParams.isVerbose(), applicationId);
    ConfigChangeActions actions = session.prepare(logger, prepareParams, currentActiveApplicationSet, tenant.getPath(), now);
    logConfigChangeActions(actions, logger);
    log.log(LogLevel.INFO, Tenants.logPre(applicationId) + "Session " + sessionId + " prepared successfully. ");
    return new PrepareResult(sessionId, actions, deployLog);
}
Also used : PrepareResult(com.yahoo.vespa.config.server.http.v2.PrepareResult) LocalSession(com.yahoo.vespa.config.server.session.LocalSession) ConfigChangeActions(com.yahoo.vespa.config.server.configchange.ConfigChangeActions) DeployHandlerLogger(com.yahoo.vespa.config.server.deploy.DeployHandlerLogger) DeployLogger(com.yahoo.config.application.api.DeployLogger) SilentDeployLogger(com.yahoo.vespa.config.server.session.SilentDeployLogger) ApplicationId(com.yahoo.config.provision.ApplicationId) ApplicationSet(com.yahoo.vespa.config.server.application.ApplicationSet) Slime(com.yahoo.slime.Slime)

Example 2 with ConfigChangeActions

use of com.yahoo.vespa.config.server.configchange.ConfigChangeActions in project vespa by vespa-engine.

the class LocalSession method prepare.

public ConfigChangeActions prepare(DeployLogger logger, PrepareParams params, Optional<ApplicationSet> currentActiveApplicationSet, Path tenantPath, Instant now) {
    Curator.CompletionWaiter waiter = zooKeeperClient.createPrepareWaiter();
    ConfigChangeActions actions = sessionPreparer.prepare(sessionContext, logger, params, currentActiveApplicationSet, tenantPath, now);
    setPrepared();
    waiter.awaitCompletion(params.getTimeoutBudget().timeLeft());
    return actions;
}
Also used : ConfigChangeActions(com.yahoo.vespa.config.server.configchange.ConfigChangeActions) Curator(com.yahoo.vespa.curator.Curator)

Example 3 with ConfigChangeActions

use of com.yahoo.vespa.config.server.configchange.ConfigChangeActions in project vespa by vespa-engine.

the class SessionPrepareHandlerTest method require_that_config_change_actions_are_logged_if_existing.

@Test
public void require_that_config_change_actions_are_logged_if_existing() throws Exception {
    List<ServiceInfo> services = Collections.singletonList(new ServiceInfo("serviceName", "serviceType", null, ImmutableMap.of("clustername", "foo", "clustertype", "bar"), "configId", "hostName"));
    ConfigChangeActions actions = new ConfigChangeActions(Arrays.asList(new MockRestartAction("change", services), new MockRefeedAction("change-id", false, "other change", services, "test")));
    MockSession session = new MockSession(1, null, actions);
    localRepo.addSession(session);
    HttpResponse response = createHandler().handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L));
    assertResponseContains(response, "Change(s) between active and new application that require restart:\\nIn cluster 'foo' of type 'bar");
    assertResponseContains(response, "Change(s) between active and new application that may require re-feed:\\nchange-id: Consider removing data and re-feed document type 'test'");
}
Also used : ServiceInfo(com.yahoo.config.model.api.ServiceInfo) ConfigChangeActions(com.yahoo.vespa.config.server.configchange.ConfigChangeActions) HttpResponse(com.yahoo.container.jdisc.HttpResponse) MockRestartAction(com.yahoo.vespa.config.server.configchange.MockRestartAction) MockRefeedAction(com.yahoo.vespa.config.server.configchange.MockRefeedAction) Test(org.junit.Test)

Aggregations

ConfigChangeActions (com.yahoo.vespa.config.server.configchange.ConfigChangeActions)3 DeployLogger (com.yahoo.config.application.api.DeployLogger)1 ServiceInfo (com.yahoo.config.model.api.ServiceInfo)1 ApplicationId (com.yahoo.config.provision.ApplicationId)1 HttpResponse (com.yahoo.container.jdisc.HttpResponse)1 Slime (com.yahoo.slime.Slime)1 ApplicationSet (com.yahoo.vespa.config.server.application.ApplicationSet)1 MockRefeedAction (com.yahoo.vespa.config.server.configchange.MockRefeedAction)1 MockRestartAction (com.yahoo.vespa.config.server.configchange.MockRestartAction)1 DeployHandlerLogger (com.yahoo.vespa.config.server.deploy.DeployHandlerLogger)1 PrepareResult (com.yahoo.vespa.config.server.http.v2.PrepareResult)1 LocalSession (com.yahoo.vespa.config.server.session.LocalSession)1 SilentDeployLogger (com.yahoo.vespa.config.server.session.SilentDeployLogger)1 Curator (com.yahoo.vespa.curator.Curator)1 Test (org.junit.Test)1