diff options
Diffstat (limited to 'client/go/cmd/helpers.go')
-rw-r--r-- | client/go/cmd/helpers.go | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/client/go/cmd/helpers.go b/client/go/cmd/helpers.go index 14699abf40e..a541f2d363a 100644 --- a/client/go/cmd/helpers.go +++ b/client/go/cmd/helpers.go @@ -55,10 +55,7 @@ func deploymentFromArgs() vespa.Deployment { if err != nil { fatalErrHint(err, "Zone format is <env>.<region>") } - app, err := vespa.ApplicationFromString(getApplication()) - if err != nil { - fatalErrHint(err, "Application format is <tenant>.<app>.<instance>") - } + app := getApplication() return vespa.Deployment{Application: app, Zone: zone} } @@ -69,17 +66,23 @@ func applicationSource(args []string) string { return "." } -func getApplication() string { +func getApplication() vespa.ApplicationID { cfg, err := LoadConfig() if err != nil { fatalErr(err, "Could not load config") - return "" + return vespa.ApplicationID{} } app, err := cfg.Get(applicationFlag) if err != nil { - fatalErr(err, "A valid application must be specified") + fatalErrHint(err, "No application specified. Try the --"+applicationFlag+" flag") + return vespa.ApplicationID{} + } + application, err := vespa.ApplicationFromString(app) + if err != nil { + fatalErrHint(err, "Application format is <tenant>.<app>.<instance>") + return vespa.ApplicationID{} } - return app + return application } func getTargetType() string { @@ -142,7 +145,7 @@ func getTarget() vespa.Target { } kp, err := tls.LoadX509KeyPair(certificateFile, privateKeyFile) if err != nil { - fatalErr(err, "Could not read key pair") + fatalErrHint(err, "Deployment to cloud requires a certificate. Try 'vespa cert'") } return vespa.CloudTarget(deployment, kp, apiKey) } |