fix(e2e): inherit installed tools for loopback hosts
Use the actual environment PATH instead of fixed system directories. Keep the fixture Python first and quote the inherited path.
8 unmodified lines9101112131415161728 unmodified lines4647484949505152535474 unmodified lines129130131132133134135136137138139140139140141142141142143144372 unmodified linesExpand all8 unmodified lines
import jsonimport osimport reimport shleximport shutilimport signalimport subprocessimport sys28 unmodified linesesaccase "$*" in *.part.*) [ -e {slow} ] && sleep 3 ;;esacpath={bin}:/usr/bin:/binpath={path}[ "$target" = oldhost ] && path={old}:$pathexec env -i HOME={home} PATH="$path" SHELL={bin}/loginsh /bin/sh -c "$*""""
74 unmodified lines old=old, home=self.remote_home, down=self.down, slow=self.slow_stage, path=shlex.quote(f"{remote}{os.pathsep}{app.daemon.env['PATH']}"), ), ) write( local / "python3", LOCAL_PYTHON.format(log=self.python_log, python=real) ) write(remote / "loginsh", LOGIN_SHELL) os.symlink(real, remote / "python3") for tool in ("git", "jj"): found = shutil.which(tool) if found: os.symlink(found, remote / tool) ssh_config = root / "user-home" / ".ssh" ssh_config.mkdir() (ssh_config / "config").write_text( "Host configured-box\n User someone\nHost *\n ServerAliveInterval 30\n"372 unmodified linesExpand all298 unmodified linesExpand all2993003013023033043053063076 unmodified lines314315316317317318319320321322346 unmodified linesExpand all298 unmodified linesExpand all python, err := exec.LookPath("python3") if err != nil { return "", err } remotePath := "'" + strings.ReplaceAll(remoteBin+string(os.PathListSeparator)+os.Getenv("PATH"), "'", "'\"'\"'") + "'" ssh := `#!/bin/shwhile [ $# -gt 0 ]; do case "$1" in -o|-O|-l|-p|-i|-F|-J|-S) shift 2 ;;6 unmodified linescase "$target" in nohost) echo "ssh: connect to host nohost port 22: Connection refused" >&2; exit 255 ;; lockedhost) echo "lockedhost: Permission denied (publickey)." >&2; exit 255 ;;esacexec env -i HOME=` + suite.remoteHome + ` PATH=` + remoteBin + `:/usr/bin:/bin SHELL=` + remoteBin + `/loginsh /bin/sh -c "$*"exec env -i HOME=` + suite.remoteHome + ` PATH=` + remotePath + ` SHELL=` + remoteBin + `/loginsh /bin/sh -c "$*"` // a login shell that sources no profile, which would put the system // python ahead of the linked one loginsh := "#!/bin/sh\n[ \"$1\" = -l ] && shift\nexec /bin/sh \"$@\"\n"346 unmodified linesExpand all