Closed bashfulrobot closed 1 year ago
I am not sure if you would want something like this added (pseudo code) - or if the current commit follows your current coding patterns/preferences.
package main
import (
"fmt"
"os/exec"
)
func main() {
binaries := []string{"ssh", "rsync", "grep"}
for _, bin := range binaries {
path, err := exec.LookPath(bin)
if err != nil {
fmt.Println(bin, "not found in the user path")
} else {
fmt.Println(bin, "found at", path)
}
}
}
@chrboe Do you remember any reason for using an absolute path for ssh
here?
I have no idea, honestly.
I have not tested this or anything, but it seems like the default value for RSYNC_RSH
is ssh
, which to me implies that rsync takes care of the $PATH
lookup. So I would expect the above to just work.
Works fine on my machine too:
$ virter --loglevel debug vm cp values.yml centos-7-200:/root
DEBU[0000] Using config file: /home/christoph/.config/virter/virter.toml
DEBU[0000] executing rsync command:
DEBU[0000] RSYNC_RSH=ssh -i "/home/christoph/.config/virter/id_rsa" -o UserKnownHostsFile=/tmp/rsync-known-hosts-3204555196 -o PubkeyAcceptedKeyTypes=+ssh-rsa /usr/bin/rsync --recursive --perms --times --protect-args values.yml root@192.168.122.200:/root
So I'm pretty sure this is good to merge. Thanks for the fix @bashfulrobot.
virter vm cp
will use /usr/bin/sshssh
was located elsewheressh
binary located in the users pathChanges to be committed: modified: pkg/netcopy/netcopy.go
Testing
I built
virter
locally and ran the same commands identified in issue #23 .As you can see the copy was successful.
Admittedly, logic could be added to test for the binaries in
$PATH