Skip to content

Commit 36a36a4

Browse files
author
liuminjian
committed
1.add http deployment method
Signed-off-by: liuminjian <[email protected]>
1 parent 28372fe commit 36a36a4

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

internal/configure/hosts/hc_get.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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

internal/configure/hosts/hosts.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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)

internal/task/task/checker/ssh.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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

4041
const (
@@ -51,7 +52,7 @@ func doNothing() step.LambdaType {
5152
func 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)

pkg/module/remote_client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ type RemoteClient interface {
5353
}
5454

5555
func 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 {

0 commit comments

Comments
 (0)