From 0bff2147e21e5e0fd005539506dfa741b1efe9c0 Mon Sep 17 00:00:00 2001 From: Wine93 Date: Fri, 14 Apr 2023 10:51:57 +0800 Subject: [PATCH] Bugfix(format): make mountpoint directories with wrong mode. --- cli/cli/cli.go | 9 +++++++++ internal/task/task/bs/format.go | 2 +- internal/task/task/common/create_container.go | 4 +--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cli/cli/cli.go b/cli/cli/cli.go index 703ca62e7..9eec462c1 100644 --- a/cli/cli/cli.go +++ b/cli/cli/cli.go @@ -380,6 +380,15 @@ func (curveadm *CurveAdm) ExecOptions() module.ExecOptions { } } +func (curveadm *CurveAdm) MkdirOptions() module.ExecOptions { + return module.ExecOptions{ + ExecWithSudo: false, + ExecInLocal: false, + ExecSudoAlias: curveadm.config.GetSudoAlias(), + ExecTimeoutSec: curveadm.config.GetTimeout(), + } +} + func (curveadm *CurveAdm) CheckId(id string) error { services, err := curveadm.Storage().GetServices(curveadm.ClusterId()) if err != nil { diff --git a/internal/task/task/bs/format.go b/internal/task/task/bs/format.go index c630bd5bd..45ccb02cf 100644 --- a/internal/task/task/bs/format.go +++ b/internal/task/task/bs/format.go @@ -220,7 +220,7 @@ func NewFormatChunkfilePoolTask(curveadm *cli.CurveAdm, fc *configure.FormatConf }) t.AddStep(&step.CreateDirectory{ Paths: []string{mountPoint}, - ExecOptions: curveadm.ExecOptions(), + ExecOptions: curveadm.MkdirOptions(), }) t.AddStep(&step.CreateFilesystem{ // mkfs.ext4 MOUNT_POINT Device: device, diff --git a/internal/task/task/common/create_container.go b/internal/task/task/common/create_container.go index 0f7bf6f81..876ed59f5 100644 --- a/internal/task/task/common/create_container.go +++ b/internal/task/task/common/create_container.go @@ -224,8 +224,6 @@ func NewCreateContainerTask(curveadm *cli.CurveAdm, dc *topology.DeployConfig) ( kind := dc.GetKind() role := dc.GetRole() hostname := fmt.Sprintf("%s-%s-%s", kind, role, serviceId) - options := curveadm.ExecOptions() - options.ExecWithSudo = false t.AddStep(&step2GetService{ // if service exist, break task serviceId: serviceId, @@ -234,7 +232,7 @@ func NewCreateContainerTask(curveadm *cli.CurveAdm, dc *topology.DeployConfig) ( }) t.AddStep(&step.CreateDirectory{ Paths: []string{dc.GetLogDir(), dc.GetDataDir()}, - ExecOptions: options, + ExecOptions: curveadm.MkdirOptions(), }) t.AddStep(&step.CreateContainer{ Image: dc.GetContainerImage(),