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 {
141
141
BecomeUser : hc .GetBecomeUser (),
142
142
ConnectTimeoutSec : curveadm .GlobalCurveAdmConfig .GetSSHTimeout (),
143
143
ConnectRetries : curveadm .GlobalCurveAdmConfig .GetSSHRetries (),
144
+ Protocol : hc .GetProtocol (),
144
145
}
145
146
}
146
147
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ import (
32
32
"github.com/opencurve/curveadm/internal/configure/os"
33
33
"github.com/opencurve/curveadm/internal/errno"
34
34
"github.com/opencurve/curveadm/internal/utils"
35
+ "github.com/opencurve/curveadm/pkg/module"
35
36
"github.com/spf13/viper"
36
37
)
37
38
@@ -158,7 +159,7 @@ func (hc *HostConfig) Build() error {
158
159
F ("hosts[%d].private_key_file = %s" , hc .sequence , privateKeyFile )
159
160
}
160
161
161
- if hc .GetForwardAgent () == false {
162
+ if hc .GetForwardAgent () == false && hc . GetProtocol () == module . SSH_PROTOCOL {
162
163
if ! utils .PathExist (privateKeyFile ) {
163
164
return errno .ERR_PRIVATE_KEY_FILE_NOT_EXIST .
164
165
F ("%s: no such file" , privateKeyFile )
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ import (
35
35
"github.com/opencurve/curveadm/internal/task/step"
36
36
"github.com/opencurve/curveadm/internal/task/task"
37
37
"github.com/opencurve/curveadm/internal/utils"
38
+ "github.com/opencurve/curveadm/pkg/module"
38
39
)
39
40
40
41
const (
@@ -51,7 +52,7 @@ func doNothing() step.LambdaType {
51
52
func checkHost (hc * hosts.HostConfig ) step.LambdaType {
52
53
return func (ctx * context.Context ) error {
53
54
privateKeyFile := hc .GetPrivateKeyFile ()
54
- if hc .GetForwardAgent () == false {
55
+ if hc .GetForwardAgent () == false && hc . GetProtocol () == module . SSH_PROTOCOL {
55
56
if ! utils .PathExist (privateKeyFile ) {
56
57
return errno .ERR_PRIVATE_KEY_FILE_NOT_EXIST .
57
58
F ("%s: no such file" , privateKeyFile )
Original file line number Diff line number Diff line change @@ -53,6 +53,10 @@ type RemoteClient interface {
53
53
}
54
54
55
55
func NewRemoteClient (cfg * ConnectConfig ) (client RemoteClient , err error ) {
56
+ if cfg == nil {
57
+ return
58
+ }
59
+
56
60
if cfg .Protocol == SSH_PROTOCOL {
57
61
client , err = NewSSHClient (* cfg .GetSSHConfig ())
58
62
if err != nil {
You can’t perform that action at this time.
0 commit comments