Skip to content

Commit

Permalink
1.add http deployment method
Browse files Browse the repository at this point in the history
Signed-off-by: liuminjian <liuminjian@chinatelecom.cn>
  • Loading branch information
liuminjian committed Dec 13, 2023
1 parent 28372fe commit 36a36a4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions internal/configure/hosts/hc_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ func (hc *HostConfig) GetConnectConfig() *module.ConnectConfig {
BecomeUser: hc.GetBecomeUser(),
ConnectTimeoutSec: curveadm.GlobalCurveAdmConfig.GetSSHTimeout(),
ConnectRetries: curveadm.GlobalCurveAdmConfig.GetSSHRetries(),
Protocol: hc.GetProtocol(),
}
}

Expand Down
3 changes: 2 additions & 1 deletion internal/configure/hosts/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/opencurve/curveadm/internal/configure/os"
"github.com/opencurve/curveadm/internal/errno"
"github.com/opencurve/curveadm/internal/utils"
"github.com/opencurve/curveadm/pkg/module"
"github.com/spf13/viper"
)

Expand Down Expand Up @@ -158,7 +159,7 @@ func (hc *HostConfig) Build() error {
F("hosts[%d].private_key_file = %s", hc.sequence, privateKeyFile)
}

if hc.GetForwardAgent() == false {
if hc.GetForwardAgent() == false && hc.GetProtocol() == module.SSH_PROTOCOL {
if !utils.PathExist(privateKeyFile) {
return errno.ERR_PRIVATE_KEY_FILE_NOT_EXIST.
F("%s: no such file", privateKeyFile)
Expand Down
3 changes: 2 additions & 1 deletion internal/task/task/checker/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/opencurve/curveadm/internal/task/step"
"github.com/opencurve/curveadm/internal/task/task"
"github.com/opencurve/curveadm/internal/utils"
"github.com/opencurve/curveadm/pkg/module"
)

const (
Expand All @@ -51,7 +52,7 @@ func doNothing() step.LambdaType {
func checkHost(hc *hosts.HostConfig) step.LambdaType {
return func(ctx *context.Context) error {
privateKeyFile := hc.GetPrivateKeyFile()
if hc.GetForwardAgent() == false {
if hc.GetForwardAgent() == false && hc.GetProtocol() == module.SSH_PROTOCOL {
if !utils.PathExist(privateKeyFile) {
return errno.ERR_PRIVATE_KEY_FILE_NOT_EXIST.
F("%s: no such file", privateKeyFile)
Expand Down
4 changes: 4 additions & 0 deletions pkg/module/remote_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ type RemoteClient interface {
}

func NewRemoteClient(cfg *ConnectConfig) (client RemoteClient, err error) {
if cfg == nil {
return
}

if cfg.Protocol == SSH_PROTOCOL {
client, err = NewSSHClient(*cfg.GetSSHConfig())
if err != nil {
Expand Down

0 comments on commit 36a36a4

Please sign in to comment.