change name
This commit is contained in:
parent
a5f4ba3c2a
commit
dabbf6d795
@ -59,12 +59,12 @@ func (command Command) runCmd() logging.Logging {
|
|||||||
remoteHost.Port = 22
|
remoteHost.Port = 22
|
||||||
remoteHost.Host = command.RemoteHost.Host
|
remoteHost.Host = command.RemoteHost.Host
|
||||||
|
|
||||||
sshConnection, err := remoteHost.ConnectToSSHHost()
|
sshClient, err := remoteHost.ConnectToSSHHost()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Errorf("ssh dial: %w", err))
|
panic(fmt.Errorf("ssh dial: %w", err))
|
||||||
}
|
}
|
||||||
defer sshConnection.Close()
|
defer sshClient.Close()
|
||||||
s, err := sshConnection.NewSession()
|
s, err := sshClient.NewSession()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Errorf("new ssh session: %w", err))
|
panic(fmt.Errorf("new ssh session: %w", err))
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ func (config SshConfig) GetSSHConfig() (SshConfig, error) {
|
|||||||
|
|
||||||
func (remoteConfig *Host) ConnectToSSHHost() (*ssh.Client, error) {
|
func (remoteConfig *Host) ConnectToSSHHost() (*ssh.Client, error) {
|
||||||
|
|
||||||
var sshConnection *ssh.Client
|
var sshClient *ssh.Client
|
||||||
var connectErr error
|
var connectErr error
|
||||||
|
|
||||||
f, _ := os.Open(filepath.Join(os.Getenv("HOME"), ".ssh", "config"))
|
f, _ := os.Open(filepath.Join(os.Getenv("HOME"), ".ssh", "config"))
|
||||||
@ -104,7 +104,7 @@ func (remoteConfig *Host) ConnectToSSHHost() (*ssh.Client, error) {
|
|||||||
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
}
|
}
|
||||||
for _, host := range remoteConfig.HostName {
|
for _, host := range remoteConfig.HostName {
|
||||||
sshConnection, connectErr = ssh.Dial("tcp", host, sshConfig)
|
sshClient, connectErr = ssh.Dial("tcp", host, sshConfig)
|
||||||
if connectErr != nil {
|
if connectErr != nil {
|
||||||
panic(fmt.Errorf("error when connecting to host %s: %w", host, connectErr))
|
panic(fmt.Errorf("error when connecting to host %s: %w", host, connectErr))
|
||||||
}
|
}
|
||||||
@ -113,5 +113,5 @@ func (remoteConfig *Host) ConnectToSSHHost() (*ssh.Client, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return sshConnection, connectErr
|
return sshClient, connectErr
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user