File tree Expand file tree Collapse file tree 4 files changed +9
-2
lines changed Expand file tree Collapse file tree 4 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,7 @@ func (hc *HostConfig) GetConnectConfig() *module.ConnectConfig {
141141 BecomeUser : hc .GetBecomeUser (),
142142 ConnectTimeoutSec : curveadm .GlobalCurveAdmConfig .GetSSHTimeout (),
143143 ConnectRetries : curveadm .GlobalCurveAdmConfig .GetSSHRetries (),
144+ Protocol : hc .GetProtocol (),
144145 }
145146}
146147
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ import (
3232 "github.com/opencurve/curveadm/internal/configure/os"
3333 "github.com/opencurve/curveadm/internal/errno"
3434 "github.com/opencurve/curveadm/internal/utils"
35+ "github.com/opencurve/curveadm/pkg/module"
3536 "github.com/spf13/viper"
3637)
3738
@@ -158,7 +159,7 @@ func (hc *HostConfig) Build() error {
158159 F ("hosts[%d].private_key_file = %s" , hc .sequence , privateKeyFile )
159160 }
160161
161- if hc .GetForwardAgent () == false {
162+ if hc .GetForwardAgent () == false && hc . GetProtocol () == module . SSH_PROTOCOL {
162163 if ! utils .PathExist (privateKeyFile ) {
163164 return errno .ERR_PRIVATE_KEY_FILE_NOT_EXIST .
164165 F ("%s: no such file" , privateKeyFile )
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ import (
3535 "github.com/opencurve/curveadm/internal/task/step"
3636 "github.com/opencurve/curveadm/internal/task/task"
3737 "github.com/opencurve/curveadm/internal/utils"
38+ "github.com/opencurve/curveadm/pkg/module"
3839)
3940
4041const (
@@ -51,7 +52,7 @@ func doNothing() step.LambdaType {
5152func checkHost (hc * hosts.HostConfig ) step.LambdaType {
5253 return func (ctx * context.Context ) error {
5354 privateKeyFile := hc .GetPrivateKeyFile ()
54- if hc .GetForwardAgent () == false {
55+ if hc .GetForwardAgent () == false && hc . GetProtocol () == module . SSH_PROTOCOL {
5556 if ! utils .PathExist (privateKeyFile ) {
5657 return errno .ERR_PRIVATE_KEY_FILE_NOT_EXIST .
5758 F ("%s: no such file" , privateKeyFile )
Original file line number Diff line number Diff line change @@ -53,6 +53,10 @@ type RemoteClient interface {
5353}
5454
5555func NewRemoteClient (cfg * ConnectConfig ) (client RemoteClient , err error ) {
56+ if cfg == nil {
57+ return
58+ }
59+
5660 if cfg .Protocol == SSH_PROTOCOL {
5761 client , err = NewSSHClient (* cfg .GetSSHConfig ())
5862 if err != nil {
You can’t perform that action at this time.
0 commit comments