summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorEirik Nygaard <eirik.nygaard@yahooinc.com>2022-03-01 19:08:25 +0100
committerEirik Nygaard <eirik.nygaard@yahooinc.com>2022-03-01 19:08:25 +0100
commitb3e60810bf96071976d310cc55f7fb78815fe2c6 (patch)
tree8f68bb1097c5c378063c25aaaddb42cf25fef5b0 /client
parent8b1f1b0ca3695cc07f39adcc3800b3e9574b89c7 (diff)
Add and use printWarning() helper
Diffstat (limited to 'client')
-rw-r--r--client/go/cmd/config.go2
-rw-r--r--client/go/cmd/helpers.go7
-rw-r--r--client/go/cmd/prod.go3
3 files changed, 9 insertions, 3 deletions
diff --git a/client/go/cmd/config.go b/client/go/cmd/config.go
index 3891ef0524d..aa459fd1edd 100644
--- a/client/go/cmd/config.go
+++ b/client/go/cmd/config.go
@@ -208,7 +208,7 @@ func (c *Config) UseAPIKey(system vespa.System, tenantName string) bool {
// TODO: Remove this when users have had time to migrate over to Auth0 device flow authentication
a, err := auth0.GetAuth0(c.AuthConfigPath(), system.Name, system.URL)
if err != nil || !a.HasSystem() {
- fmt.Fprintln(stderr, "Defaulting to tenant API key is deprecated. Use Auth0 device flow: 'vespa auth login' instead")
+ printWarning("Defaulting to tenant API key is deprecated.", "Use Auth0 device flow: 'vespa auth login' instead")
return util.PathExists(c.APIKeyPath(tenantName))
}
return false
diff --git a/client/go/cmd/helpers.go b/client/go/cmd/helpers.go
index 9003a64b33b..61a3257b58c 100644
--- a/client/go/cmd/helpers.go
+++ b/client/go/cmd/helpers.go
@@ -31,6 +31,13 @@ func printSuccess(msg ...interface{}) {
log.Print(color.Green("Success: "), fmt.Sprint(msg...))
}
+func printWarning(msg string, hints ...string) {
+ fmt.Fprintln(stderr, color.Yellow("Warning:"), msg)
+ for _, hint := range hints {
+ fmt.Fprintln(stderr, color.Cyan("Hint:"), hint)
+ }
+}
+
func athenzPath(filename string) (string, error) {
userHome, err := os.UserHomeDir()
if err != nil {
diff --git a/client/go/cmd/prod.go b/client/go/cmd/prod.go
index 7ba6072b3a9..b30f2e8551d 100644
--- a/client/go/cmd/prod.go
+++ b/client/go/cmd/prod.go
@@ -157,8 +157,7 @@ $ vespa prod submit`,
}
isCI := os.Getenv("CI") != ""
if !isCI {
- fmt.Fprintln(stderr, color.Yellow("Warning:"), "We recommend doing this only from a CD job")
- fmt.Fprintln(stderr, color.Cyan("Hint:"), "See https://cloud.vespa.ai/en/getting-to-production")
+ printWarning("We recommend doing this only from a CD job", "See https://cloud.vespa.ai/en/getting-to-production")
}
opts, err := getDeploymentOptions(cfg, pkg, target)
if err != nil {