aboutsummaryrefslogtreecommitdiffstats
path: root/client/go
diff options
context:
space:
mode:
authorArne Juul <arnej@yahooinc.com>2023-06-29 08:47:21 +0000
committerArne Juul <arnej@yahooinc.com>2023-06-29 08:47:21 +0000
commit828c5dcaaa70b1c07090b476ff834bb9f1a20f40 (patch)
treea7ab5c570f35f9707bd81c18bc8ceb24ca651254 /client/go
parent943849d98f9d1d72ec5b1b0fda3a01ae64cb1ada (diff)
allow "vespa-logfmt" to work without full vespa install
Diffstat (limited to 'client/go')
-rw-r--r--client/go/internal/admin/vespa-wrapper/logfmt/cmd.go12
-rw-r--r--client/go/internal/admin/vespa-wrapper/main.go10
2 files changed, 18 insertions, 4 deletions
diff --git a/client/go/internal/admin/vespa-wrapper/logfmt/cmd.go b/client/go/internal/admin/vespa-wrapper/logfmt/cmd.go
index 4406457ac23..e0124a5970e 100644
--- a/client/go/internal/admin/vespa-wrapper/logfmt/cmd.go
+++ b/client/go/internal/admin/vespa-wrapper/logfmt/cmd.go
@@ -5,10 +5,22 @@
package logfmt
import (
+ "os"
+
"github.com/spf13/cobra"
"github.com/vespa-engine/vespa/client/go/internal/build"
+ "github.com/vespa-engine/vespa/client/go/internal/vespa"
)
+func RunCmdLine() {
+ _ = vespa.FindHome()
+ cobra := NewLogfmtCmd()
+ err := cobra.Execute()
+ if err != nil {
+ os.Exit(1)
+ }
+}
+
func NewLogfmtCmd() *cobra.Command {
var (
curOptions Options = NewOptions()
diff --git a/client/go/internal/admin/vespa-wrapper/main.go b/client/go/internal/admin/vespa-wrapper/main.go
index eed8ac5b57b..8f822483534 100644
--- a/client/go/internal/admin/vespa-wrapper/main.go
+++ b/client/go/internal/admin/vespa-wrapper/main.go
@@ -28,12 +28,17 @@ func basename(s string) string {
func main() {
defer handleSimplePanic()
- _ = vespa.FindAndVerifyVespaHome()
action := basename(os.Args[0])
if action == "vespa-wrapper" && len(os.Args) > 1 {
action = os.Args[1]
os.Args = os.Args[1:]
}
+ if action == "vespa-logfmt" {
+ // "vespa-logfmt" does not require verified VESPA_HOME
+ logfmt.RunCmdLine()
+ return
+ }
+ _ = vespa.FindAndVerifyVespaHome()
switch action {
case "vespa-stop-services":
os.Exit(services.VespaStopServices())
@@ -73,9 +78,6 @@ func main() {
case "vespa-deploy":
cobra := deploy.NewDeployCmd()
cobra.Execute()
- case "vespa-logfmt":
- cobra := logfmt.NewLogfmtCmd()
- cobra.Execute()
case "vespa-get-cluster-state":
cobra := clusterstate.NewGetClusterStateCmd()
cobra.Execute()