aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/go/cmd/deploy.go1
-rw-r--r--client/go/cmd/deploy_test.go2
-rw-r--r--client/go/vespa/deploy.go18
3 files changed, 19 insertions, 2 deletions
diff --git a/client/go/cmd/deploy.go b/client/go/cmd/deploy.go
index e72667e49b6..012570c5471 100644
--- a/client/go/cmd/deploy.go
+++ b/client/go/cmd/deploy.go
@@ -132,6 +132,7 @@ func newPrepareCmd(cli *CLI) *cobra.Command {
return fmt.Errorf("could not write session id: %w", err)
}
cli.printSuccess("Prepared ", color.CyanString(pkg.Path), " with session ", result.ID)
+ printPrepareLog(cli.Stderr, result)
return nil
},
}
diff --git a/client/go/cmd/deploy_test.go b/client/go/cmd/deploy_test.go
index fe3e0ca0467..236ae74f47e 100644
--- a/client/go/cmd/deploy_test.go
+++ b/client/go/cmd/deploy_test.go
@@ -121,7 +121,7 @@ func assertDeploy(applicationPackage string, arguments []string, t *testing.T) {
func assertPrepare(applicationPackage string, arguments []string, t *testing.T) {
t.Helper()
client := &mock.HTTPClient{}
- client.NextResponseString(200, `{"session-id":"42"}`)
+ client.NextResponseString(200, `{"session-id":"42","message":"Session 42 for tenant 'default' prepared.","log":[{"level":"WARNING","message":"Warning message 1","time": 1430134091319}]}`)
cli, stdout, _ := newTestCLI(t)
cli.httpClient = client
assert.Nil(t, cli.Run(arguments...))
diff --git a/client/go/vespa/deploy.go b/client/go/vespa/deploy.go
index ad4fc5f3022..0e086979d72 100644
--- a/client/go/vespa/deploy.go
+++ b/client/go/vespa/deploy.go
@@ -143,7 +143,23 @@ func Prepare(deployment DeploymentOptions) (PrepareResult, error) {
if err := checkResponse(req, response, serviceDescription); err != nil {
return PrepareResult{}, err
}
- return result, nil
+ var jsonResponse struct {
+ SessionID string `json:"session-id"`
+ Log []LogLinePrepareResponse `json:"log"`
+ }
+ jsonDec := json.NewDecoder(response.Body)
+ if err := jsonDec.Decode(&jsonResponse); err != nil {
+ return PrepareResult{}, err
+ }
+ var id int64
+ id, err = strconv.ParseInt(jsonResponse.SessionID, 10, 64)
+ if err != nil {
+ return PrepareResult{}, err
+ }
+ return PrepareResult{
+ ID: id,
+ LogLines: jsonResponse.Log,
+ }, err
}
// Activate deployment with sessionID from a past prepare