From f854eee4619c15b36282c9021c1736b346ab8d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8A=E7=8F=AD=E4=B8=8D=E6=91=B8=E9=B1=BC?= Date: Tue, 4 Apr 2023 11:19:45 +0800 Subject: [PATCH] fix vppctl file path issue --- providers/docker/handler.go | 6 +++++- vpp/instance.go | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/providers/docker/handler.go b/providers/docker/handler.go index dee08c8..e6055ed 100644 --- a/providers/docker/handler.go +++ b/providers/docker/handler.go @@ -70,7 +70,11 @@ func (h *ContainerHandler) GetCLI() (probe.CliExecutor, error) { args = append(args, "-s", "localhost:5002") logrus.Tracef("checking cli socket error: %v, using flag '%s' for vppctl", err, args) } - wrapper := exec.Wrap(h, "/usr/bin/vppctl", args...) + vppctl := "/usr/bin/vppctl" + if _, err := h.Command("ls", vppctl).Output(); err != nil { + vppctl = "vppctl" + } + wrapper := exec.Wrap(h, vppctl, args...) cli := vppcli.ExecutorFunc(func(cmd string) (string, error) { out, err := wrapper.Command(cmd).Output() if err != nil { diff --git a/vpp/instance.go b/vpp/instance.go index 2d2d2e3..7cc2e64 100644 --- a/vpp/instance.go +++ b/vpp/instance.go @@ -213,7 +213,11 @@ func (v *Instance) initCLI() error { args = append(args, "-s", defaultCliAddr) logrus.Tracef("checking cli socket error: %v, using flag '%s' for vppctl", err, args) } - wrapper := exec.Wrap(v.handler, "/usr/bin/vppctl", args...) + vppctl := "/usr/bin/vppctl" + if _, err := v.handler.Command("ls", vppctl).Output(); err != nil { + vppctl = "vppctl" + } + wrapper := exec.Wrap(v.handler, vppctl, args...) cli := vppcli.ExecutorFunc(func(cmd string) (string, error) { c := `"` + cmd + `"` out, err := wrapper.Command(c).Output()