Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion providers/docker/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps using vppctl instead of /usr/bin/vppctl might be better choice? I don't see much sense in calling ls /usr/bin/vppctl everytime we invoke VPP CLI. We should either cache the result or rely on the system's PATH to resolve vppctl.

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 {
Expand Down
6 changes: 5 additions & 1 deletion vpp/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down