diff --git a/Makefile b/Makefile index aca1e9f9b..8244624db 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,6 @@ GO := go # output OUTPUT := bin/curveadm -SERVER_OUTPUT := bin/pigeon # build flags LDFLAGS := -s -w @@ -53,7 +52,6 @@ TEST_FLAGS += -run $(CASE) # packages PACKAGES := $(PWD)/cmd/curveadm/main.go -SERVER_PACKAGES := $(PWD)/cmd/service/main.go # tar VERSION := "unknown" diff --git a/cli/command/cmd.go b/cli/command/cmd.go index 55a2769ac..0660c0378 100644 --- a/cli/command/cmd.go +++ b/cli/command/cmd.go @@ -67,7 +67,7 @@ func addSubCommands(cmd *cobra.Command, curveadm *cli.CurveAdm) { target.NewTargetCommand(curveadm), // curveadm target ... pfs.NewPFSCommand(curveadm), // curveadm pfs ... monitor.NewMonitorCommand(curveadm), // curveadm monitor ... - daemon.NewDaemonCommand(curveadm), // curveadm http + daemon.NewDaemonCommand(curveadm), // curveadm deamon ... NewAuditCommand(curveadm), // curveadm audit NewCleanCommand(curveadm), // curveadm clean diff --git a/cli/command/daemon/cmd.go b/cli/command/daemon/cmd.go index 52597d074..a879354ac 100644 --- a/cli/command/daemon/cmd.go +++ b/cli/command/daemon/cmd.go @@ -16,8 +16,8 @@ /* * Project: Curveadm -* Created Date: 2023-03-31 -* Author: wanghai (SeanHai) +* Created Date: 2023-12-13 +* Author: liuminjian */ package daemon @@ -31,7 +31,7 @@ import ( func NewDaemonCommand(curveadm *cli.CurveAdm) *cobra.Command { cmd := &cobra.Command{ Use: "daemon", - Short: "Manage http service", + Short: "Manage curveadm deamon service", Args: cliutil.NoArgs, RunE: cliutil.ShowHelp(curveadm.Err()), } diff --git a/internal/configure/hosts/hc_get.go b/internal/configure/hosts/hc_get.go index 1f857875e..a8ab33faf 100644 --- a/internal/configure/hosts/hc_get.go +++ b/internal/configure/hosts/hc_get.go @@ -141,6 +141,7 @@ func (hc *HostConfig) GetConnectConfig() *module.ConnectConfig { BecomeUser: hc.GetBecomeUser(), ConnectTimeoutSec: curveadm.GlobalCurveAdmConfig.GetSSHTimeout(), ConnectRetries: curveadm.GlobalCurveAdmConfig.GetSSHRetries(), + Protocol: hc.GetProtocol(), } } diff --git a/internal/configure/hosts/hosts.go b/internal/configure/hosts/hosts.go index c8fa86011..e9ffcfe30 100644 --- a/internal/configure/hosts/hosts.go +++ b/internal/configure/hosts/hosts.go @@ -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" ) @@ -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) diff --git a/internal/task/task/checker/ssh.go b/internal/task/task/checker/ssh.go index e3d4f05e0..37ac818c2 100644 --- a/internal/task/task/checker/ssh.go +++ b/internal/task/task/checker/ssh.go @@ -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 ( @@ -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) diff --git a/pkg/module/remote_client.go b/pkg/module/remote_client.go index 81516994c..aad2577eb 100644 --- a/pkg/module/remote_client.go +++ b/pkg/module/remote_client.go @@ -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 { diff --git a/scripts/install.sh b/scripts/install.sh index 5f0ac801e..c25771f01 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -47,8 +47,8 @@ backup() { } setup() { - mkdir -p "${g_curveadm_home}"/{bin,data,module,logs,conf,temp} - + mkdir -p "${g_curveadm_home}"/{bin,data,module,logs,temp} + mkdir -p "${g_curveadm_home}"/daemon/{logs,conf} # generate config file local confpath="${g_curveadm_home}/curveadm.cfg" if [ ! -f "${confpath}" ]; then @@ -70,7 +70,7 @@ __EOF__ # generate http service config file - local httpConfpath="${g_curveadm_home}/conf/pigeon.yaml" + local httpConfpath="${g_curveadm_home}/daemon/conf/pigeon.yaml" if [ ! -f $httpConfpath ]; then cat << __EOF__ > $httpConfpath servers: