(ctx context.Context, osArchStr string)
| 662 | } |
| 663 | |
| 664 | func (conn *SSHConn) InstallWsh(ctx context.Context, osArchStr string) error { |
| 665 | conn.Infof(ctx, "running installWsh...\n") |
| 666 | client := conn.GetClient() |
| 667 | if client == nil { |
| 668 | conn.Infof(ctx, "ERROR ssh client is not connected, cannot install\n") |
| 669 | return fmt.Errorf("ssh client is not connected, cannot install") |
| 670 | } |
| 671 | var clientOs, clientArch string |
| 672 | var err error |
| 673 | if osArchStr != "" { |
| 674 | clientOs, clientArch, err = remote.GetClientPlatformFromOsArchStr(ctx, osArchStr) |
| 675 | } else { |
| 676 | clientOs, clientArch, err = remote.GetClientPlatform(ctx, genconn.MakeSSHShellClient(client)) |
| 677 | } |
| 678 | if err != nil { |
| 679 | conn.Infof(ctx, "ERROR detecting client platform: %v\n", err) |
| 680 | return fmt.Errorf("error detecting client platform: %w", err) |
| 681 | } |
| 682 | conn.Infof(ctx, "detected remote platform os:%s arch:%s\n", clientOs, clientArch) |
| 683 | err = remote.CpWshToRemote(ctx, client, clientOs, clientArch) |
| 684 | if err != nil { |
| 685 | conn.Infof(ctx, "ERROR copying wsh binary to remote: %v\n", err) |
| 686 | return fmt.Errorf("error copying wsh binary to remote: %w", err) |
| 687 | } |
| 688 | conn.Infof(ctx, "successfully installed wsh\n") |
| 689 | return nil |
| 690 | } |
| 691 | |
| 692 | func (conn *SSHConn) GetClient() *ssh.Client { |
| 693 | conn.lock.Lock() |
no test coverage detected