aboutsummaryrefslogtreecommitdiffstats
path: root/client/go/internal/cli
diff options
context:
space:
mode:
Diffstat (limited to 'client/go/internal/cli')
-rw-r--r--client/go/internal/cli/auth/auth.go2
-rw-r--r--client/go/internal/cli/auth/auth0/auth0.go2
-rw-r--r--client/go/internal/cli/auth/auth0/auth0_test.go1
-rw-r--r--client/go/internal/cli/auth/secrets.go2
-rw-r--r--client/go/internal/cli/auth/token.go2
-rw-r--r--client/go/internal/cli/auth/zts/zts.go1
-rw-r--r--client/go/internal/cli/auth/zts/zts_test.go1
-rw-r--r--client/go/internal/cli/cmd/api_key.go24
-rw-r--r--client/go/internal/cli/cmd/api_key_test.go4
-rw-r--r--client/go/internal/cli/cmd/auth.go1
-rw-r--r--client/go/internal/cli/cmd/cert.go22
-rw-r--r--client/go/internal/cli/cmd/cert_test.go2
-rw-r--r--client/go/internal/cli/cmd/clone.go6
-rw-r--r--client/go/internal/cli/cmd/clone_list.go2
-rw-r--r--client/go/internal/cli/cmd/clone_list_test.go2
-rw-r--r--client/go/internal/cli/cmd/clone_test.go2
-rw-r--r--client/go/internal/cli/cmd/config.go49
-rw-r--r--client/go/internal/cli/cmd/config_test.go2
-rw-r--r--client/go/internal/cli/cmd/curl.go5
-rw-r--r--client/go/internal/cli/cmd/curl_test.go2
-rw-r--r--client/go/internal/cli/cmd/deploy.go8
-rw-r--r--client/go/internal/cli/cmd/deploy_test.go2
-rw-r--r--client/go/internal/cli/cmd/destroy.go5
-rw-r--r--client/go/internal/cli/cmd/destroy_test.go1
-rw-r--r--client/go/internal/cli/cmd/document.go4
-rw-r--r--client/go/internal/cli/cmd/document_test.go2
-rw-r--r--client/go/internal/cli/cmd/feed.go7
-rw-r--r--client/go/internal/cli/cmd/feed_test.go1
-rw-r--r--client/go/internal/cli/cmd/gendoc.go2
-rw-r--r--client/go/internal/cli/cmd/log.go2
-rw-r--r--client/go/internal/cli/cmd/log_test.go2
-rw-r--r--client/go/internal/cli/cmd/login.go11
-rw-r--r--client/go/internal/cli/cmd/logout.go1
-rw-r--r--client/go/internal/cli/cmd/man.go2
-rw-r--r--client/go/internal/cli/cmd/man_test.go2
-rw-r--r--client/go/internal/cli/cmd/prod.go2
-rw-r--r--client/go/internal/cli/cmd/prod_test.go1
-rw-r--r--client/go/internal/cli/cmd/query.go4
-rw-r--r--client/go/internal/cli/cmd/query_test.go2
-rw-r--r--client/go/internal/cli/cmd/root.go12
-rw-r--r--client/go/internal/cli/cmd/status.go74
-rw-r--r--client/go/internal/cli/cmd/status_test.go35
-rw-r--r--client/go/internal/cli/cmd/test.go4
-rw-r--r--client/go/internal/cli/cmd/test_test.go2
-rw-r--r--client/go/internal/cli/cmd/testdata/applications/withEmptyTarget/pom.xml2
-rw-r--r--client/go/internal/cli/cmd/testdata/applications/withSource/src/main/application/hosts.xml2
-rw-r--r--client/go/internal/cli/cmd/testdata/applications/withSource/src/main/application/schemas/msmarco.sd2
-rw-r--r--client/go/internal/cli/cmd/testdata/applications/withSource/src/main/application/services.xml2
-rw-r--r--client/go/internal/cli/cmd/testdata/applications/withTarget/pom.xml2
-rw-r--r--client/go/internal/cli/cmd/testutil_test.go2
-rw-r--r--client/go/internal/cli/cmd/version.go4
-rw-r--r--client/go/internal/cli/cmd/version_test.go2
-rw-r--r--client/go/internal/cli/cmd/vespa/main.go2
-rw-r--r--client/go/internal/cli/cmd/visit.go6
-rw-r--r--client/go/internal/cli/cmd/visit_test.go2
-rw-r--r--client/go/internal/cli/cmd/waiter.go8
-rw-r--r--client/go/internal/cli/config/config.go2
-rw-r--r--client/go/internal/cli/config/config_test.go2
58 files changed, 226 insertions, 136 deletions
diff --git a/client/go/internal/cli/auth/auth.go b/client/go/internal/cli/auth/auth.go
index 100af7ea1d2..fd2cbfa2400 100644
--- a/client/go/internal/cli/auth/auth.go
+++ b/client/go/internal/cli/auth/auth.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package auth
diff --git a/client/go/internal/cli/auth/auth0/auth0.go b/client/go/internal/cli/auth/auth0/auth0.go
index 6fcd3f7680e..7fae6e78b61 100644
--- a/client/go/internal/cli/auth/auth0/auth0.go
+++ b/client/go/internal/cli/auth/auth0/auth0.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package auth0
diff --git a/client/go/internal/cli/auth/auth0/auth0_test.go b/client/go/internal/cli/auth/auth0/auth0_test.go
index b4bd34eb6d6..0127e5642c2 100644
--- a/client/go/internal/cli/auth/auth0/auth0_test.go
+++ b/client/go/internal/cli/auth/auth0/auth0_test.go
@@ -1,3 +1,4 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package auth0
import (
diff --git a/client/go/internal/cli/auth/secrets.go b/client/go/internal/cli/auth/secrets.go
index e38d8c56595..90732ed16a0 100644
--- a/client/go/internal/cli/auth/secrets.go
+++ b/client/go/internal/cli/auth/secrets.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package auth
diff --git a/client/go/internal/cli/auth/token.go b/client/go/internal/cli/auth/token.go
index d6f5e6dfa43..a7744b58486 100644
--- a/client/go/internal/cli/auth/token.go
+++ b/client/go/internal/cli/auth/token.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package auth
diff --git a/client/go/internal/cli/auth/zts/zts.go b/client/go/internal/cli/auth/zts/zts.go
index 19ea6e48b0c..b60aa363e70 100644
--- a/client/go/internal/cli/auth/zts/zts.go
+++ b/client/go/internal/cli/auth/zts/zts.go
@@ -1,3 +1,4 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package zts
import (
diff --git a/client/go/internal/cli/auth/zts/zts_test.go b/client/go/internal/cli/auth/zts/zts_test.go
index ad1ed66f460..5f41aae9403 100644
--- a/client/go/internal/cli/auth/zts/zts_test.go
+++ b/client/go/internal/cli/auth/zts/zts_test.go
@@ -1,3 +1,4 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package zts
import (
diff --git a/client/go/internal/cli/cmd/api_key.go b/client/go/internal/cli/cmd/api_key.go
index 7c187aa5da7..ef04532314c 100644
--- a/client/go/internal/cli/cmd/api_key.go
+++ b/client/go/internal/cli/cmd/api_key.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// vespa api-key command
// Author: mpolden
package cmd
@@ -18,14 +18,17 @@ func newAPIKeyCmd(cli *CLI) *cobra.Command {
var overwriteKey bool
cmd := &cobra.Command{
Use: "api-key",
- Short: "Create a new user API key for control-plane authentication with Vespa Cloud",
- Long: `Create a new user API key for control-plane authentication with Vespa Cloud.
+ Short: "Create a new developer key for headless authentication with Vespa Cloud control plane",
+ Long: `Create a new developer key for headless authentication with Vespa Cloud control plane
-The API key will be stored in the Vespa CLI home directory
-(see 'vespa help config'). Other commands will then automatically load the API
+A developer key is intended for headless communication with the Vespa Cloud
+control plane. For example when deploying from a continuous integration system.
+
+The developer key will be stored in the Vespa CLI home directory
+(see 'vespa help config'). Other commands will then automatically load the developer
key as necessary.
-It's possible to override the API key used through environment variables. This
+It's possible to override the developer key used through environment variables. This
can be useful in continuous integration systems.
Example of setting the key in-line:
@@ -36,8 +39,9 @@ Example of loading the key from a custom path:
export VESPA_CLI_API_KEY_FILE=/path/to/api-key
-Note that when overriding API key through environment variables, that key will
-always be used. It's not possible to specify a tenant-specific key.
+Note that when overriding the developer key through environment variables,
+that key will always be used. It's not possible to specify a tenant-specific
+key through the environment.
Read more in https://cloud.vespa.ai/en/security/guide`,
Example: "$ vespa auth api-key -a my-tenant.my-app.my-instance",
@@ -48,7 +52,7 @@ Read more in https://cloud.vespa.ai/en/security/guide`,
return doApiKey(cli, overwriteKey, args)
},
}
- cmd.Flags().BoolVarP(&overwriteKey, "force", "f", false, "Force overwrite of existing API key")
+ cmd.Flags().BoolVarP(&overwriteKey, "force", "f", false, "Force overwrite of existing developer key")
cmd.MarkPersistentFlagRequired(applicationFlag)
return cmd
}
@@ -78,7 +82,7 @@ func doApiKey(cli *CLI, overwriteKey bool, args []string) error {
return fmt.Errorf("could not create api key: %w", err)
}
if err := os.WriteFile(apiKeyFile, apiKey, 0600); err == nil {
- cli.printSuccess("API private key written to ", apiKeyFile)
+ cli.printSuccess("Developer private key written to ", apiKeyFile)
return printPublicKey(system, apiKeyFile, app.Tenant)
} else {
return fmt.Errorf("failed to write: %s: %w", apiKeyFile, err)
diff --git a/client/go/internal/cli/cmd/api_key_test.go b/client/go/internal/cli/cmd/api_key_test.go
index 9c14033f85b..18baec91e0c 100644
--- a/client/go/internal/cli/cmd/api_key_test.go
+++ b/client/go/internal/cli/cmd/api_key_test.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// Author: mpolden
package cmd
@@ -25,7 +25,7 @@ func testAPIKey(t *testing.T, subcommand []string) {
err = cli.Run(args...)
assert.Nil(t, err)
assert.Equal(t, "", stderr.String())
- assert.Contains(t, stdout.String(), "Success: API private key written to")
+ assert.Contains(t, stdout.String(), "Success: Developer private key written to")
err = cli.Run(subcommand...)
assert.NotNil(t, err)
diff --git a/client/go/internal/cli/cmd/auth.go b/client/go/internal/cli/cmd/auth.go
index 453d2296b08..9dbf95ab70b 100644
--- a/client/go/internal/cli/cmd/auth.go
+++ b/client/go/internal/cli/cmd/auth.go
@@ -1,3 +1,4 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
diff --git a/client/go/internal/cli/cmd/cert.go b/client/go/internal/cli/cmd/cert.go
index 5c1ed04ab4e..1cc50b1faea 100644
--- a/client/go/internal/cli/cmd/cert.go
+++ b/client/go/internal/cli/cmd/cert.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// vespa cert command
// Author: mpolden
package cmd
@@ -21,8 +21,8 @@ func newCertCmd(cli *CLI) *cobra.Command {
)
cmd := &cobra.Command{
Use: "cert",
- Short: "Create a new private key and self-signed certificate for data-plane access with Vespa Cloud",
- Long: `Create a new private key and self-signed certificate for data-plane access with Vespa Cloud.
+ Short: "Create a new self-signed certificate for authentication with Vespa Cloud data plane",
+ Long: `Create a new self-signed certificate for authentication with Vespa Cloud data plane.
The private key and certificate will be stored in the Vespa CLI home directory
(see 'vespa help config'). Other commands will then automatically load the
@@ -32,8 +32,10 @@ package specified as an argument to this command (default '.').
It's possible to override the private key and certificate used through
environment variables. This can be useful in continuous integration systems.
-It's also possible override the CA certificate which can be useful when using self-signed certificates with a
-self-hosted Vespa service. See https://docs.vespa.ai/en/mtls.html for more information.
+It's also possible override the CA certificate which can be useful when using
+self-signed certificates with a self-hosted Vespa service.
+See https://docs.vespa.ai/en/operations-selfhosted/mtls.html for more
+information.
Example of setting the CA certificate, certificate and key in-line:
@@ -47,12 +49,18 @@ Example of loading CA certificate, certificate and key from custom paths:
export VESPA_CLI_DATA_PLANE_CERT_FILE=/path/to/cert
export VESPA_CLI_DATA_PLANE_KEY_FILE=/path/to/key
+Example of disabling verification of the server's certificate chain and
+hostname:
+
+ export VESPA_CLI_DATA_PLANE_TRUST_ALL=true
+
Note that when overriding key pair through environment variables, that key pair
will always be used for all applications. It's not possible to specify an
application-specific key.
-Read more in https://cloud.vespa.ai/en/security/guide`,
- Example: `$ vespa auth cert -a my-tenant.my-app.my-instance
+See https://cloud.vespa.ai/en/security/guide for more details.`,
+ Example: `$ vespa auth cert
+$ vespa auth cert -a my-tenant.my-app.my-instance
$ vespa auth cert -a my-tenant.my-app.my-instance path/to/application/package`,
DisableAutoGenTag: true,
SilenceUsage: true,
diff --git a/client/go/internal/cli/cmd/cert_test.go b/client/go/internal/cli/cmd/cert_test.go
index 491857f2bf2..61e90e21176 100644
--- a/client/go/internal/cli/cmd/cert_test.go
+++ b/client/go/internal/cli/cmd/cert_test.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// Author: mpolden
package cmd
diff --git a/client/go/internal/cli/cmd/clone.go b/client/go/internal/cli/cmd/clone.go
index a835892990b..8fd12eb9e6e 100644
--- a/client/go/internal/cli/cmd/clone.go
+++ b/client/go/internal/cli/cmd/clone.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// vespa clone command
// author: bratseth
@@ -31,8 +31,8 @@ func newCloneCmd(cli *CLI) *cobra.Command {
)
cmd := &cobra.Command{
Use: "clone sample-application-path target-directory",
- Short: "Create files and directory structure for a new Vespa application from a sample application",
- Long: `Create files and directory structure for a new Vespa application
+ Short: "Create files and directory structure from a Vespa sample application",
+ Long: `Create files and directory structure from a Vespa sample application
from a sample application.
Sample applications are downloaded from
diff --git a/client/go/internal/cli/cmd/clone_list.go b/client/go/internal/cli/cmd/clone_list.go
index 826aea7b75e..40656841276 100644
--- a/client/go/internal/cli/cmd/clone_list.go
+++ b/client/go/internal/cli/cmd/clone_list.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
diff --git a/client/go/internal/cli/cmd/clone_list_test.go b/client/go/internal/cli/cmd/clone_list_test.go
index f69ad2be8cf..bff629541de 100644
--- a/client/go/internal/cli/cmd/clone_list_test.go
+++ b/client/go/internal/cli/cmd/clone_list_test.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
diff --git a/client/go/internal/cli/cmd/clone_test.go b/client/go/internal/cli/cmd/clone_test.go
index 3d7250cc760..331845b3883 100644
--- a/client/go/internal/cli/cmd/clone_test.go
+++ b/client/go/internal/cli/cmd/clone_test.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// init command tests
// Author: bratseth
diff --git a/client/go/internal/cli/cmd/config.go b/client/go/internal/cli/cmd/config.go
index 2ebd6b0793e..cfadc6d32c5 100644
--- a/client/go/internal/cli/cmd/config.go
+++ b/client/go/internal/cli/cmd/config.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// vespa config command
// author: bratseth
@@ -30,8 +30,8 @@ const (
func newConfigCmd() *cobra.Command {
return &cobra.Command{
Use: "config",
- Short: "Configure persistent values for global flags",
- Long: `Configure persistent values for global flags.
+ Short: "Manage persistent values for global flags",
+ Long: `Manage persistent values for global flags.
This command allows setting persistent values for global flags. On future
invocations the flag can then be omitted as it is read from the config file
@@ -42,7 +42,8 @@ overridden by setting the VESPA_CLI_HOME environment variable.
When setting an option locally, the configuration is written to .vespa in the
working directory, where that directory is assumed to be a Vespa application
-directory. This allows you have separate configuration options per application.
+directory. This allows you to have separate configuration options per
+application.
Vespa CLI chooses the value for a given option in the following order, from
most to least preferred:
@@ -57,10 +58,10 @@ The following global flags/options can be configured:
application
Specifies the application ID to manage. It has three parts, separated by
-dots, with the third part being optional. This is only relevant for the "cloud"
-and "hosted" targets. See https://cloud.vespa.ai/en/tenant-apps-instances for
-more details. This has no default value. Examples: tenant1.app1,
-tenant1.app1.instance1
+dots, with the third part being optional. If the part is omitted it defaults to
+"default". This is only relevant for the "cloud" and "hosted" targets. See
+https://cloud.vespa.ai/en/tenant-apps-instances for more details. This has no
+default value. Examples: tenant1.app1, tenant1.app1.instance1
cluster
@@ -80,28 +81,40 @@ instance
Specifies the instance of the application to manage. When specified, this takes
precedence over the instance specified as part of application. This has no
-default value. Example: instance2
+default value and is only relevant for the "cloud" and "hosted" targets.
+Example: instance2
quiet
-Print only errors.
+Suppress informational output. Errors are still printed.
target
Specifies the target to use for commands that interact with a Vespa platform,
e.g. vespa deploy or vespa query. Possible values are:
-- local: (default) Connect to a Vespa platform running at localhost
-- cloud: Connect to Vespa Cloud
-- hosted: Connect to hosted Vespa (internal platform)
-- *url*: Connect to a platform running at given URL.
+- local: (default) Connect to a Vespa platform running at localhost. When using
+ this target, container clusters are automatically discovered and are
+ chosen with the cluster option. This assumes that the configserver is
+ available on port 19071 (the default when using the Vespa container
+ image).
+- cloud: Connect to Vespa Cloud. When using this target, container clusters are
+ automatically discovered and can be selected with the cluster option.
+- hosted: Connect to hosted Vespa (reserved for internal use)
+- *url*: Connect to a platform running at given URL. This instructs the command
+ you're running to target a concrete URL. The cluster option cannot be
+ used with this target.
+
+Authentication is configured automatically for the cloud and hosted targets. To
+set a custom private key and certificate, e.g. for use with a self-hosted Vespa
+installation using mTLS, see the documentation of 'vespa cert'.
zone
-Specifies a custom dev or perf zone to use when connecting to a Vespa platform.
-This is only relevant for cloud and hosted targets. By default, a zone is
-chosen automatically. See https://cloud.vespa.ai/en/reference/zones for
-available zones. Examples: dev.aws-us-east-1c, perf.aws-us-east-1c
+Specifies a custom zone to use when connecting to a Vespa Cloud application.
+This is only relevant for cloud and hosted targets and defaults to a dev zone.
+See https://cloud.vespa.ai/en/reference/zones for available zones. Examples:
+dev.aws-us-east-1c, dev.gcp-us-central1-f, perf.aws-us-east-1c
`,
DisableAutoGenTag: true,
SilenceUsage: false,
diff --git a/client/go/internal/cli/cmd/config_test.go b/client/go/internal/cli/cmd/config_test.go
index 7a4035f54a3..64d7d91fef1 100644
--- a/client/go/internal/cli/cmd/config_test.go
+++ b/client/go/internal/cli/cmd/config_test.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
diff --git a/client/go/internal/cli/cmd/curl.go b/client/go/internal/cli/cmd/curl.go
index 2c754022901..4a919d18d49 100644
--- a/client/go/internal/cli/cmd/curl.go
+++ b/client/go/internal/cli/cmd/curl.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
@@ -41,7 +41,7 @@ $ vespa curl -- -v --data-urlencode "yql=select * from music where album contain
}
var service *vespa.Service
useDeploy := curlService == "deploy"
- waiter := cli.waiter(false, time.Duration(waitSecs)*time.Second)
+ waiter := cli.waiter(time.Duration(waitSecs) * time.Second)
if useDeploy {
if cli.config.cluster() != "" {
return fmt.Errorf("cannot specify cluster for service %s", curlService)
@@ -59,6 +59,7 @@ $ vespa curl -- -v --data-urlencode "yql=select * from music where album contain
if err != nil {
return err
}
+ // TODO(mpolden): Support issuing request to deploy service
if useDeploy {
if err := addAccessToken(c, target); err != nil {
return err
diff --git a/client/go/internal/cli/cmd/curl_test.go b/client/go/internal/cli/cmd/curl_test.go
index 520cf41e308..35c228edb0a 100644
--- a/client/go/internal/cli/cmd/curl_test.go
+++ b/client/go/internal/cli/cmd/curl_test.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
diff --git a/client/go/internal/cli/cmd/deploy.go b/client/go/internal/cli/cmd/deploy.go
index 1f1a24bbd98..aee26975901 100644
--- a/client/go/internal/cli/cmd/deploy.go
+++ b/client/go/internal/cli/cmd/deploy.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// vespa deploy command
// Author: bratseth
@@ -73,7 +73,7 @@ $ vespa deploy -t cloud -z perf.aws-us-east-1c`,
return err
}
}
- waiter := cli.waiter(false, timeout)
+ waiter := cli.waiter(timeout)
if _, err := waiter.DeployService(target); err != nil {
return err
}
@@ -158,7 +158,7 @@ func newActivateCmd(cli *CLI) *cobra.Command {
return err
}
timeout := time.Duration(waitSecs) * time.Second
- waiter := cli.waiter(false, timeout)
+ waiter := cli.waiter(timeout)
if _, err := waiter.DeployService(target); err != nil {
return err
}
@@ -179,7 +179,7 @@ func waitForDeploymentReady(cli *CLI, target vespa.Target, sessionOrRunID int64,
if timeout == 0 {
return nil
}
- waiter := cli.waiter(false, timeout)
+ waiter := cli.waiter(timeout)
if _, err := waiter.Deployment(target, sessionOrRunID); err != nil {
return err
}
diff --git a/client/go/internal/cli/cmd/deploy_test.go b/client/go/internal/cli/cmd/deploy_test.go
index d2aa52bc08f..c0652c30863 100644
--- a/client/go/internal/cli/cmd/deploy_test.go
+++ b/client/go/internal/cli/cmd/deploy_test.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// deploy command tests
// Author: bratseth
diff --git a/client/go/internal/cli/cmd/destroy.go b/client/go/internal/cli/cmd/destroy.go
index 38d93f49675..f4822330e05 100644
--- a/client/go/internal/cli/cmd/destroy.go
+++ b/client/go/internal/cli/cmd/destroy.go
@@ -1,3 +1,4 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
@@ -12,8 +13,8 @@ func newDestroyCmd(cli *CLI) *cobra.Command {
force := false
cmd := &cobra.Command{
Use: "destroy",
- Short: "Remove a deployed application and its data",
- Long: `Remove a deployed application and its data.
+ Short: "Remove a deployed Vespa application and its data",
+ Long: `Remove a deployed Vespa application and its data.
This command removes the currently deployed application and permanently
deletes its data.
diff --git a/client/go/internal/cli/cmd/destroy_test.go b/client/go/internal/cli/cmd/destroy_test.go
index 44610576d7e..bbba593cc5d 100644
--- a/client/go/internal/cli/cmd/destroy_test.go
+++ b/client/go/internal/cli/cmd/destroy_test.go
@@ -1,3 +1,4 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
diff --git a/client/go/internal/cli/cmd/document.go b/client/go/internal/cli/cmd/document.go
index 6c46baa297a..a98e9867d34 100644
--- a/client/go/internal/cli/cmd/document.go
+++ b/client/go/internal/cli/cmd/document.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// vespa document command
// author: bratseth
@@ -298,7 +298,7 @@ func documentService(cli *CLI, waitSecs int) (*vespa.Service, error) {
if err != nil {
return nil, err
}
- waiter := cli.waiter(false, time.Duration(waitSecs)*time.Second)
+ waiter := cli.waiter(time.Duration(waitSecs) * time.Second)
return waiter.Service(target, cli.config.cluster())
}
diff --git a/client/go/internal/cli/cmd/document_test.go b/client/go/internal/cli/cmd/document_test.go
index 64319296299..636059acfde 100644
--- a/client/go/internal/cli/cmd/document_test.go
+++ b/client/go/internal/cli/cmd/document_test.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// document command tests
// Author: bratseth
diff --git a/client/go/internal/cli/cmd/feed.go b/client/go/internal/cli/cmd/feed.go
index 8b8589baec3..1a32ac7110d 100644
--- a/client/go/internal/cli/cmd/feed.go
+++ b/client/go/internal/cli/cmd/feed.go
@@ -1,3 +1,4 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
@@ -57,8 +58,8 @@ func newFeedCmd(cli *CLI) *cobra.Command {
var options feedOptions
cmd := &cobra.Command{
Use: "feed json-file [json-file]...",
- Short: "Feed multiple document operations to a Vespa cluster",
- Long: `Feed multiple document operations to a Vespa cluster.
+ Short: "Feed multiple document operations to Vespa",
+ Long: `Feed multiple document operations to Vespa.
This command can be used to feed large amounts of documents to a Vespa cluster
efficiently.
@@ -107,7 +108,7 @@ func createServices(n int, timeout time.Duration, waitSecs int, cli *CLI) ([]uti
}
services := make([]util.HTTPClient, 0, n)
baseURL := ""
- waiter := cli.waiter(false, time.Duration(waitSecs)*time.Second)
+ waiter := cli.waiter(time.Duration(waitSecs) * time.Second)
for i := 0; i < n; i++ {
service, err := waiter.Service(target, cli.config.cluster())
if err != nil {
diff --git a/client/go/internal/cli/cmd/feed_test.go b/client/go/internal/cli/cmd/feed_test.go
index f34cc66e9a2..1cf9a6aba3c 100644
--- a/client/go/internal/cli/cmd/feed_test.go
+++ b/client/go/internal/cli/cmd/feed_test.go
@@ -1,3 +1,4 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
diff --git a/client/go/internal/cli/cmd/gendoc.go b/client/go/internal/cli/cmd/gendoc.go
index 70d166bb9ce..62415111035 100644
--- a/client/go/internal/cli/cmd/gendoc.go
+++ b/client/go/internal/cli/cmd/gendoc.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
diff --git a/client/go/internal/cli/cmd/log.go b/client/go/internal/cli/cmd/log.go
index 8d3f3f4f384..e7178b74a56 100644
--- a/client/go/internal/cli/cmd/log.go
+++ b/client/go/internal/cli/cmd/log.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
diff --git a/client/go/internal/cli/cmd/log_test.go b/client/go/internal/cli/cmd/log_test.go
index 8727c82fede..c1cab951793 100644
--- a/client/go/internal/cli/cmd/log_test.go
+++ b/client/go/internal/cli/cmd/log_test.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
diff --git a/client/go/internal/cli/cmd/login.go b/client/go/internal/cli/cmd/login.go
index d6eb8207b7f..b380e627203 100644
--- a/client/go/internal/cli/cmd/login.go
+++ b/client/go/internal/cli/cmd/login.go
@@ -1,3 +1,4 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
@@ -18,9 +19,13 @@ import (
// this will only affect the messages.
func newLoginCmd(cli *CLI) *cobra.Command {
return &cobra.Command{
- Use: "login",
- Args: cobra.NoArgs,
- Short: "Authenticate Vespa CLI with Vespa Cloud",
+ Use: "login",
+ Args: cobra.NoArgs,
+ Short: "Authenticate Vespa CLI with Vespa Cloud control plane. This is preferred over api-key for interactive use",
+ Long: `Authenticate Vespa CLI with Vespa Cloud control plane. This is preferred over api-key for interactive use.
+
+This command runs a browser-based authentication flow for the Vespa Cloud control plane.
+`,
Example: "$ vespa auth login",
DisableAutoGenTag: true,
SilenceUsage: true,
diff --git a/client/go/internal/cli/cmd/logout.go b/client/go/internal/cli/cmd/logout.go
index 204513145aa..6cfa6f5b876 100644
--- a/client/go/internal/cli/cmd/logout.go
+++ b/client/go/internal/cli/cmd/logout.go
@@ -1,3 +1,4 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
diff --git a/client/go/internal/cli/cmd/man.go b/client/go/internal/cli/cmd/man.go
index 4d139adb244..12912718e43 100644
--- a/client/go/internal/cli/cmd/man.go
+++ b/client/go/internal/cli/cmd/man.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
diff --git a/client/go/internal/cli/cmd/man_test.go b/client/go/internal/cli/cmd/man_test.go
index 0c214698047..ad05efcb2a3 100644
--- a/client/go/internal/cli/cmd/man_test.go
+++ b/client/go/internal/cli/cmd/man_test.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
diff --git a/client/go/internal/cli/cmd/prod.go b/client/go/internal/cli/cmd/prod.go
index 5337a346654..3ff46768e0c 100644
--- a/client/go/internal/cli/cmd/prod.go
+++ b/client/go/internal/cli/cmd/prod.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
diff --git a/client/go/internal/cli/cmd/prod_test.go b/client/go/internal/cli/cmd/prod_test.go
index 4cca54a76c8..5594c846cc8 100644
--- a/client/go/internal/cli/cmd/prod_test.go
+++ b/client/go/internal/cli/cmd/prod_test.go
@@ -1,3 +1,4 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
diff --git a/client/go/internal/cli/cmd/query.go b/client/go/internal/cli/cmd/query.go
index f72d1de2843..bf2272ca981 100644
--- a/client/go/internal/cli/cmd/query.go
+++ b/client/go/internal/cli/cmd/query.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// vespa query command
// author: bratseth
@@ -64,7 +64,7 @@ func query(cli *CLI, arguments []string, timeoutSecs, waitSecs int, curl bool) e
if err != nil {
return err
}
- waiter := cli.waiter(false, time.Duration(waitSecs)*time.Second)
+ waiter := cli.waiter(time.Duration(waitSecs) * time.Second)
service, err := waiter.Service(target, cli.config.cluster())
if err != nil {
return err
diff --git a/client/go/internal/cli/cmd/query_test.go b/client/go/internal/cli/cmd/query_test.go
index 6d5adc0508e..4a35f1530ec 100644
--- a/client/go/internal/cli/cmd/query_test.go
+++ b/client/go/internal/cli/cmd/query_test.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// query command tests
// Author: bratseth
diff --git a/client/go/internal/cli/cmd/root.go b/client/go/internal/cli/cmd/root.go
index c3a3db0df57..068a7ed90b6 100644
--- a/client/go/internal/cli/cmd/root.go
+++ b/client/go/internal/cli/cmd/root.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
@@ -213,10 +213,10 @@ func (c *CLI) configureFlags() map[string]*pflag.Flag {
quiet bool
)
c.cmd.PersistentFlags().StringVarP(&target, targetFlag, "t", "local", `The target platform to use. Must be "local", "cloud", "hosted" or an URL`)
- c.cmd.PersistentFlags().StringVarP(&application, applicationFlag, "a", "", "The application to use")
- c.cmd.PersistentFlags().StringVarP(&instance, instanceFlag, "i", "", "The instance of the application to use")
+ c.cmd.PersistentFlags().StringVarP(&application, applicationFlag, "a", "", "The application to use (cloud only)")
+ c.cmd.PersistentFlags().StringVarP(&instance, instanceFlag, "i", "", "The instance of the application to use (cloud only)")
c.cmd.PersistentFlags().StringVarP(&cluster, clusterFlag, "C", "", "The container cluster to use. This is only required for applications with multiple clusters")
- c.cmd.PersistentFlags().StringVarP(&zone, zoneFlag, "z", "", "The zone to use. This defaults to a dev zone")
+ c.cmd.PersistentFlags().StringVarP(&zone, zoneFlag, "z", "", "The zone to use. This defaults to a dev zone (cloud only)")
c.cmd.PersistentFlags().StringVarP(&color, colorFlag, "c", "auto", `Whether to use colors in output. Must be "auto", "never", or "always"`)
c.cmd.PersistentFlags().BoolVarP(&quiet, quietFlag, "q", false, "Print only errors")
flags := make(map[string]*pflag.Flag)
@@ -345,9 +345,7 @@ func (c *CLI) confirm(question string, confirmByDefault bool) (bool, error) {
}
}
-func (c *CLI) waiter(once bool, timeout time.Duration) *Waiter {
- return &Waiter{Once: once, Timeout: timeout, cli: c}
-}
+func (c *CLI) waiter(timeout time.Duration) *Waiter { return &Waiter{Timeout: timeout, cli: c} }
// target creates a target according the configuration of this CLI and given opts.
func (c *CLI) target(opts targetOptions) (vespa.Target, error) {
diff --git a/client/go/internal/cli/cmd/status.go b/client/go/internal/cli/cmd/status.go
index b88db6e0d0b..a0602494bff 100644
--- a/client/go/internal/cli/cmd/status.go
+++ b/client/go/internal/cli/cmd/status.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// vespa status command
// author: bratseth
@@ -25,9 +25,14 @@ func newStatusCmd(cli *CLI) *cobra.Command {
"status document", // TODO: Remove on Vespa 9
"status query", // TODO: Remove on Vespa 9
},
- Short: "Verify that container service(s) are ready to use",
+ Short: "Show Vespa endpoints and status",
+ Long: `Show Vespa endpoints and status.
+
+This command shows the current endpoints, and their status, of a deployed Vespa
+application.`,
Example: `$ vespa status
-$ vespa status --cluster mycluster`,
+$ vespa status --cluster mycluster
+$ vespa status --cluster mycluster --wait 600`,
DisableAutoGenTag: true,
SilenceUsage: true,
Args: cobra.MaximumNArgs(1),
@@ -37,7 +42,8 @@ $ vespa status --cluster mycluster`,
if err != nil {
return err
}
- waiter := cli.waiter(true, time.Duration(waitSecs)*time.Second)
+ waiter := cli.waiter(time.Duration(waitSecs) * time.Second)
+ var failingContainers []*vespa.Service
if cluster == "" {
services, err := waiter.Services(t)
if err != nil {
@@ -47,28 +53,46 @@ $ vespa status --cluster mycluster`,
return errHint(fmt.Errorf("no services exist"), "Deployment may not be ready yet", "Try 'vespa status deployment'")
}
for _, s := range services {
- printReadyService(s, cli)
+ if !printServiceStatus(s, waiter, cli) {
+ failingContainers = append(failingContainers, s)
+ }
}
- return nil
} else {
s, err := waiter.Service(t, cluster)
if err != nil {
return err
}
- printReadyService(s, cli)
- return nil
+ if !printServiceStatus(s, waiter, cli) {
+ failingContainers = append(failingContainers, s)
+ }
}
+ return failingServicesErr(failingContainers...)
},
}
cli.bindWaitFlag(cmd, 0, &waitSecs)
return cmd
}
+func failingServicesErr(services ...*vespa.Service) error {
+ if len(services) == 0 {
+ return nil
+ }
+ var nameOrURL []string
+ for _, s := range services {
+ if s.Name != "" {
+ nameOrURL = append(nameOrURL, s.Name)
+ } else {
+ nameOrURL = append(nameOrURL, s.BaseURL)
+ }
+ }
+ return fmt.Errorf("services not ready: %s", strings.Join(nameOrURL, ", "))
+}
+
func newStatusDeployCmd(cli *CLI) *cobra.Command {
var waitSecs int
cmd := &cobra.Command{
Use: "deploy",
- Short: "Verify that the deploy service is ready to use",
+ Short: "Show status of the Vespa deploy service",
Example: `$ vespa status deploy`,
DisableAutoGenTag: true,
SilenceUsage: true,
@@ -78,12 +102,14 @@ func newStatusDeployCmd(cli *CLI) *cobra.Command {
if err != nil {
return err
}
- waiter := cli.waiter(true, time.Duration(waitSecs)*time.Second)
+ waiter := cli.waiter(time.Duration(waitSecs) * time.Second)
s, err := waiter.DeployService(t)
if err != nil {
return err
}
- printReadyService(s, cli)
+ if !printServiceStatus(s, waiter, cli) {
+ return failingServicesErr(s)
+ }
return nil
},
}
@@ -95,10 +121,17 @@ func newStatusDeploymentCmd(cli *CLI) *cobra.Command {
var waitSecs int
cmd := &cobra.Command{
Use: "deployment",
- Short: "Verify that deployment has converged on latest, or given, ID",
+ Short: "Show status of a Vespa deployment",
+ Long: `Show status of a Vespa deployment.
+
+This commands shows whether a Vespa deployment has converged on the latest run
+ (Vespa Cloud) or config generation (self-hosted). If an argument is given,
+show the convergence status of that particular run or generation.
+`,
Example: `$ vespa status deployment
$ vespa status deployment -t cloud [run-id]
$ vespa status deployment -t local [session-id]
+$ vespa status deployment -t local [session-id] --wait 600
`,
DisableAutoGenTag: true,
SilenceUsage: true,
@@ -116,7 +149,7 @@ $ vespa status deployment -t local [session-id]
if err != nil {
return err
}
- waiter := cli.waiter(true, time.Duration(waitSecs)*time.Second)
+ waiter := cli.waiter(time.Duration(waitSecs) * time.Second)
id, err := waiter.Deployment(t, wantedID)
if err != nil {
return err
@@ -134,8 +167,19 @@ $ vespa status deployment -t local [session-id]
return cmd
}
-func printReadyService(s *vespa.Service, cli *CLI) {
+func printServiceStatus(s *vespa.Service, waiter *Waiter, cli *CLI) bool {
desc := s.Description()
desc = strings.ToUpper(string(desc[0])) + string(desc[1:])
- log.Print(desc, " at ", color.CyanString(s.BaseURL), " is ", color.GreenString("ready"))
+ err := s.Wait(waiter.Timeout)
+ var sb strings.Builder
+ sb.WriteString(fmt.Sprintf("%s at %s is ", desc, color.CyanString(s.BaseURL)))
+ if err == nil {
+ sb.WriteString(color.GreenString("ready"))
+ } else {
+ sb.WriteString(color.RedString("not ready"))
+ sb.WriteString(": ")
+ sb.WriteString(err.Error())
+ }
+ fmt.Fprintln(cli.Stdout, sb.String())
+ return err == nil
}
diff --git a/client/go/internal/cli/cmd/status_test.go b/client/go/internal/cli/cmd/status_test.go
index 7e1e266f694..1473e39ff54 100644
--- a/client/go/internal/cli/cmd/status_test.go
+++ b/client/go/internal/cli/cmd/status_test.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// status command tests
// Author: bratseth
@@ -38,12 +38,18 @@ func TestStatusCommandMultiCluster(t *testing.T) {
mockServiceStatus(client)
assert.NotNil(t, cli.Run("status"))
assert.Equal(t, "Error: no services exist\nHint: Deployment may not be ready yet\nHint: Try 'vespa status deployment'\n", stderr.String())
+ stderr.Reset()
mockServiceStatus(client, "foo", "bar")
- assert.Nil(t, cli.Run("status"))
+ client.NextStatus(200)
+ client.NextStatus(400) // One cluster is unavilable
+ assert.NotNil(t, cli.Run("status"))
assert.Equal(t, `Container bar at http://127.0.0.1:8080 is ready
-Container foo at http://127.0.0.1:8080 is ready
+Container foo at http://127.0.0.1:8080 is not ready: unhealthy container foo: status 400 at http://127.0.0.1:8080/status.html: aborting wait: got status 400
`, stdout.String())
+ assert.Equal(t,
+ "Error: services not ready: foo\n",
+ stderr.String())
stdout.Reset()
mockServiceStatus(client, "foo", "bar")
@@ -60,7 +66,7 @@ func TestStatusCommandMultiClusterWait(t *testing.T) {
client.NextStatus(400)
assert.NotNil(t, cli.Run("status", "--cluster", "foo", "--wait", "10"))
assert.Equal(t, "Waiting up to 10s for cluster discovery...\nWaiting up to 10s for container foo...\n"+
- "Error: unhealthy container foo after waiting up to 10s: status 400 at http://127.0.0.1:8080/ApplicationStatus: aborting wait: got status 400\n", stderr.String())
+ "Error: unhealthy container foo after waiting up to 10s: status 400 at http://127.0.0.1:8080/status.html: aborting wait: got status 400\n", stderr.String())
}
func TestStatusCommandWithUrlTarget(t *testing.T) {
@@ -75,18 +81,25 @@ func TestStatusError(t *testing.T) {
client := &mock.HTTPClient{}
mockServiceStatus(client, "default")
client.NextStatus(500)
- cli, _, stderr := newTestCLI(t)
+ cli, stdout, stderr := newTestCLI(t)
cli.httpClient = client
assert.NotNil(t, cli.Run("status", "container"))
assert.Equal(t,
- "Error: unhealthy container default: status 500 at http://127.0.0.1:8080/ApplicationStatus: wait timed out\n",
+ "Container default at http://127.0.0.1:8080 is not ready: unhealthy container default: status 500 at http://127.0.0.1:8080/status.html: wait timed out\n",
+ stdout.String())
+ assert.Equal(t,
+ "Error: services not ready: default\n",
stderr.String())
+ stdout.Reset()
stderr.Reset()
client.NextResponseError(io.EOF)
assert.NotNil(t, cli.Run("status", "container", "-t", "http://example.com"))
assert.Equal(t,
- "Error: unhealthy container at http://example.com/ApplicationStatus: EOF\n",
+ "Container at http://example.com is not ready: unhealthy container at http://example.com/status.html: EOF\n",
+ stdout.String())
+ assert.Equal(t,
+ "Error: services not ready: http://example.com\n",
stderr.String())
}
@@ -189,7 +202,7 @@ func assertStatus(expectedTarget string, args []string, t *testing.T) {
clusterName = "foo"
mockServiceStatus(client, clusterName)
}
- client.NextResponse(mock.HTTPResponse{URI: "/ApplicationStatus", Status: 200})
+ client.NextResponse(mock.HTTPResponse{URI: "/status.html", Status: 200})
}
cli, stdout, _ := newTestCLI(t)
cli.httpClient = client
@@ -200,14 +213,14 @@ func assertStatus(expectedTarget string, args []string, t *testing.T) {
prefix += " " + clusterName
}
assert.Equal(t, prefix+" at "+expectedTarget+" is ready\n", stdout.String())
- assert.Equal(t, expectedTarget+"/ApplicationStatus", client.LastRequest.URL.String())
+ assert.Equal(t, expectedTarget+"/status.html", client.LastRequest.URL.String())
// Test legacy command
statusArgs = []string{"status query"}
stdout.Reset()
assert.Nil(t, cli.Run(append(statusArgs, args...)...))
assert.Equal(t, prefix+" at "+expectedTarget+" is ready\n", stdout.String())
- assert.Equal(t, expectedTarget+"/ApplicationStatus", client.LastRequest.URL.String())
+ assert.Equal(t, expectedTarget+"/status.html", client.LastRequest.URL.String())
}
func assertDocumentStatus(target string, args []string, t *testing.T) {
@@ -223,5 +236,5 @@ func assertDocumentStatus(target string, args []string, t *testing.T) {
"Container (document API) at "+target+" is ready\n",
stdout.String(),
"vespa status container")
- assert.Equal(t, target+"/ApplicationStatus", client.LastRequest.URL.String())
+ assert.Equal(t, target+"/status.html", client.LastRequest.URL.String())
}
diff --git a/client/go/internal/cli/cmd/test.go b/client/go/internal/cli/cmd/test.go
index 5b99973d879..f0432dd4f70 100644
--- a/client/go/internal/cli/cmd/test.go
+++ b/client/go/internal/cli/cmd/test.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// vespa test command
// Author: jonmv
@@ -220,7 +220,7 @@ func verify(step step, defaultCluster string, defaultParameters map[string]strin
service, ok = context.clusters[cluster]
if !ok {
// Cache service so we don't have to discover it for every step
- waiter := context.cli.waiter(false, time.Duration(waitSecs)*time.Second)
+ waiter := context.cli.waiter(time.Duration(waitSecs) * time.Second)
service, err = waiter.Service(target, cluster)
if err != nil {
return "", "", err
diff --git a/client/go/internal/cli/cmd/test_test.go b/client/go/internal/cli/cmd/test_test.go
index 4f8e6d49a2a..9237221f003 100644
--- a/client/go/internal/cli/cmd/test_test.go
+++ b/client/go/internal/cli/cmd/test_test.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// test command tests
// Author: jonmv
diff --git a/client/go/internal/cli/cmd/testdata/applications/withEmptyTarget/pom.xml b/client/go/internal/cli/cmd/testdata/applications/withEmptyTarget/pom.xml
index bb7a232ea2a..be81005ba51 100644
--- a/client/go/internal/cli/cmd/testdata/applications/withEmptyTarget/pom.xml
+++ b/client/go/internal/cli/cmd/testdata/applications/withEmptyTarget/pom.xml
@@ -1,2 +1,2 @@
-<!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<!-- Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
<services/>
diff --git a/client/go/internal/cli/cmd/testdata/applications/withSource/src/main/application/hosts.xml b/client/go/internal/cli/cmd/testdata/applications/withSource/src/main/application/hosts.xml
index 4b4f607ea95..f66a5ec0eb0 100644
--- a/client/go/internal/cli/cmd/testdata/applications/withSource/src/main/application/hosts.xml
+++ b/client/go/internal/cli/cmd/testdata/applications/withSource/src/main/application/hosts.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
-<!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<!-- Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
<hosts>
<host name="localhost">
<alias>node1</alias>
diff --git a/client/go/internal/cli/cmd/testdata/applications/withSource/src/main/application/schemas/msmarco.sd b/client/go/internal/cli/cmd/testdata/applications/withSource/src/main/application/schemas/msmarco.sd
index 3c481edc10d..57e000cfc45 100644
--- a/client/go/internal/cli/cmd/testdata/applications/withSource/src/main/application/schemas/msmarco.sd
+++ b/client/go/internal/cli/cmd/testdata/applications/withSource/src/main/application/schemas/msmarco.sd
@@ -1,4 +1,4 @@
-# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
schema msmarco {
document msmarco {
diff --git a/client/go/internal/cli/cmd/testdata/applications/withSource/src/main/application/services.xml b/client/go/internal/cli/cmd/testdata/applications/withSource/src/main/application/services.xml
index 60267517c33..ccf66eaa407 100644
--- a/client/go/internal/cli/cmd/testdata/applications/withSource/src/main/application/services.xml
+++ b/client/go/internal/cli/cmd/testdata/applications/withSource/src/main/application/services.xml
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<!-- Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
<services version="1.0">
diff --git a/client/go/internal/cli/cmd/testdata/applications/withTarget/pom.xml b/client/go/internal/cli/cmd/testdata/applications/withTarget/pom.xml
index bb7a232ea2a..be81005ba51 100644
--- a/client/go/internal/cli/cmd/testdata/applications/withTarget/pom.xml
+++ b/client/go/internal/cli/cmd/testdata/applications/withTarget/pom.xml
@@ -1,2 +1,2 @@
-<!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<!-- Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
<services/>
diff --git a/client/go/internal/cli/cmd/testutil_test.go b/client/go/internal/cli/cmd/testutil_test.go
index c16c9f8dc50..89f40035f6a 100644
--- a/client/go/internal/cli/cmd/testutil_test.go
+++ b/client/go/internal/cli/cmd/testutil_test.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
diff --git a/client/go/internal/cli/cmd/version.go b/client/go/internal/cli/cmd/version.go
index aaf2c42cded..f110541c192 100644
--- a/client/go/internal/cli/cmd/version.go
+++ b/client/go/internal/cli/cmd/version.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
@@ -22,7 +22,7 @@ func newVersionCmd(cli *CLI) *cobra.Command {
var skipVersionCheck bool
cmd := &cobra.Command{
Use: "version",
- Short: "Show current version and check for updates",
+ Short: "Show current CLI version and check for updates",
DisableAutoGenTag: true,
SilenceUsage: true,
Args: cobra.ExactArgs(0),
diff --git a/client/go/internal/cli/cmd/version_test.go b/client/go/internal/cli/cmd/version_test.go
index 70eaf1814e7..47b1b26de3d 100644
--- a/client/go/internal/cli/cmd/version_test.go
+++ b/client/go/internal/cli/cmd/version_test.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
diff --git a/client/go/internal/cli/cmd/vespa/main.go b/client/go/internal/cli/cmd/vespa/main.go
index ade27680230..6d203e5f05d 100644
--- a/client/go/internal/cli/cmd/vespa/main.go
+++ b/client/go/internal/cli/cmd/vespa/main.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// Entrypoint for Vespa CLI
// Author: bratseth
diff --git a/client/go/internal/cli/cmd/visit.go b/client/go/internal/cli/cmd/visit.go
index e44634cece2..bb226701e0a 100644
--- a/client/go/internal/cli/cmd/visit.go
+++ b/client/go/internal/cli/cmd/visit.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// vespa visit command
// Author: arnej
@@ -90,8 +90,8 @@ func newVisitCmd(cli *CLI) *cobra.Command {
)
cmd := &cobra.Command{
Use: "visit",
- Short: "Visit and print all documents in a Vespa cluster",
- Long: `Visit and print all documents in a Vespa cluster.
+ Short: "Fetch and print all documents from Vespa",
+ Long: `Fetch and print all documents from Vespa.
By default prints each document received on its own line (JSONL format).
`,
diff --git a/client/go/internal/cli/cmd/visit_test.go b/client/go/internal/cli/cmd/visit_test.go
index bd806f1d9c9..3053b987838 100644
--- a/client/go/internal/cli/cmd/visit_test.go
+++ b/client/go/internal/cli/cmd/visit_test.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
diff --git a/client/go/internal/cli/cmd/waiter.go b/client/go/internal/cli/cmd/waiter.go
index 34a10ccce33..0cfb3aa76d5 100644
--- a/client/go/internal/cli/cmd/waiter.go
+++ b/client/go/internal/cli/cmd/waiter.go
@@ -1,3 +1,4 @@
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
@@ -10,17 +11,12 @@ import (
// Waiter waits for Vespa services to become ready, within a timeout.
type Waiter struct {
- // Once species whether we should wait at least one time, irregardless of timeout.
- Once bool
-
// Timeout specifies how long we should wait for an operation to complete.
Timeout time.Duration // TODO(mpolden): Consider making this a budget
cli *CLI
}
-func (w *Waiter) wait() bool { return w.Once || w.Timeout > 0 }
-
// DeployService returns the service providing the deploy API on given target,
func (w *Waiter) DeployService(target vespa.Target) (*vespa.Service, error) {
s, err := target.DeployService()
@@ -73,8 +69,6 @@ func (w *Waiter) Services(target vespa.Target) ([]*vespa.Service, error) {
func (w *Waiter) maybeWaitFor(service *vespa.Service) error {
if w.Timeout > 0 {
w.cli.printInfo("Waiting up to ", color.CyanString(w.Timeout.String()), " for ", service.Description(), "...")
- }
- if w.wait() {
return service.Wait(w.Timeout)
}
return nil
diff --git a/client/go/internal/cli/config/config.go b/client/go/internal/cli/config/config.go
index beffff6e257..96ead2f40d7 100644
--- a/client/go/internal/cli/config/config.go
+++ b/client/go/internal/cli/config/config.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package config
import (
diff --git a/client/go/internal/cli/config/config_test.go b/client/go/internal/cli/config/config_test.go
index 1458771a5f5..4aaf500bce0 100644
--- a/client/go/internal/cli/config/config_test.go
+++ b/client/go/internal/cli/config/config_test.go
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package config
import (