Skip to content

Commit 5b0cd13

Browse files
committed
Fix(map): wrong checker for create option.
Signed-off-by: Wine93 <[email protected]>
1 parent 9430af0 commit 5b0cd13

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

internal/task/task/bs/create_volume.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ rootUserPassword=root_password
4343
`
4444
)
4545

46+
func checkCreateOption(create bool) step.LambdaType {
47+
return func(ctx *context.Context) error {
48+
if !create {
49+
return task.ERR_SKIP_TASK
50+
}
51+
return nil
52+
}
53+
}
54+
4655
func checkVolumeStatus(out *string) step.LambdaType {
4756
return func(ctx *context.Context) error {
4857
if len(*out) == 0 {
@@ -71,8 +80,6 @@ func NewCreateVolumeTask(curveadm *cli.CurveAdm, cc *configure.ClientConfig) (*t
7180
hc, err := curveadm.GetHost(options.Host)
7281
if err != nil {
7382
return nil, err
74-
} else if !options.Create {
75-
return nil, task.ERR_SKIP_TASK
7683
}
7784

7885
subname := fmt.Sprintf("hostname=%s image=%s", hc.GetHostname(), cc.GetContainerImage())
@@ -86,6 +93,9 @@ func NewCreateVolumeTask(curveadm *cli.CurveAdm, cc *configure.ClientConfig) (*t
8693
script := scripts.CREATE_VOLUME
8794
scriptPath := "/curvebs/nebd/sbin/create.sh"
8895
command := fmt.Sprintf("/bin/bash %s %s %s %d %s", scriptPath, options.User, options.Volume, options.Size, options.Poolset)
96+
t.AddStep(&step.Lambda{
97+
Lambda: checkCreateOption(options.Create),
98+
})
8999
t.AddStep(&step.ListContainers{
90100
ShowAll: true,
91101
Format: "'{{.Status}}'",

0 commit comments

Comments
 (0)