rancher/wins

cli prc command checks Container Pathing

Opened this issue · 0 comments

there's been a usability problem with wins for quite some time regarding the cli prc command. the idea is youre calling out to the host via grpc to execute the exe on the host. the process to do this is from a container and since this code here

func GetBinaryPath(binaryName string) (string, error) {
// find service abs path
p, err := exec.LookPath(binaryName)
if err != nil {
return "", err
}
p, err = filepath.Abs(p)
if err != nil {
return "", err
}
// detect service is file or not
fi, err := os.Stat(p)
if err == nil {
if !fi.IsDir() {
return p, nil
}
err = errors.Errorf("%s is directory", p)
}
if filepath.Ext(p) == "" {
p += ".exe"
fi, err := os.Stat(p)
if err == nil {
if !fi.IsDir() {
return p, nil
}
return "", errors.Errorf("%s is directory", p)
}
}
return "", err
}

this code is run in the container via cli prc and it checks the container for the binary and then calls the binary via grpc on the host meaning the binary has to be in both locations. in the container and on the host. we've basically been getting around this problem with copying files everywhere in run.ps1 powershell scripts.

proposal... add grpc logic so the cli prc command asks the host via the socket if the binary is there, is the right hash etc.