Search in sources :

Example 1 with DeployHandlerLogger

use of com.yahoo.vespa.config.server.deploy.DeployHandlerLogger 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 DeployHandlerLogger

use of com.yahoo.vespa.config.server.deploy.DeployHandlerLogger in project vespa by vespa-engine.

the class DeployHandlerLoggerTest method testLogging.

private void testLogging(boolean verbose, String expectedPattern) throws IOException {
    Slime slime = new Slime();
    Cursor array = slime.setArray();
    DeployLogger logger = new DeployHandlerLogger(array, verbose, new ApplicationId.Builder().tenant("testtenant").applicationName("testapp").build());
    logMessages(logger);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    new JsonFormat(true).encode(baos, slime);
    assertTrue(Pattern.matches(expectedPattern, baos.toString()));
}
Also used : JsonFormat(com.yahoo.slime.JsonFormat) DeployHandlerLogger(com.yahoo.vespa.config.server.deploy.DeployHandlerLogger) DeployLogger(com.yahoo.config.application.api.DeployLogger) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Slime(com.yahoo.slime.Slime) Cursor(com.yahoo.slime.Cursor)

Aggregations

DeployLogger (com.yahoo.config.application.api.DeployLogger)2 Slime (com.yahoo.slime.Slime)2 DeployHandlerLogger (com.yahoo.vespa.config.server.deploy.DeployHandlerLogger)2 ApplicationId (com.yahoo.config.provision.ApplicationId)1 Cursor (com.yahoo.slime.Cursor)1 JsonFormat (com.yahoo.slime.JsonFormat)1 ApplicationSet (com.yahoo.vespa.config.server.application.ApplicationSet)1 ConfigChangeActions (com.yahoo.vespa.config.server.configchange.ConfigChangeActions)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 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1