mirror of
https://github.com/kubesphere/kubekey.git
synced 2025-12-25 17:12:50 +00:00
feat: mark task as skipped when all loop was skipped
Signed-off-by: William Wang <williamw0825@gmail.com>
This commit is contained in:
parent
99116417d1
commit
2b5f060fea
|
|
@ -168,17 +168,21 @@ func (e *taskExecutor) execTaskHost(i int, h string) func(ctx context.Context) {
|
|||
}
|
||||
// execute module in loop with loop item.
|
||||
// if loop is empty. execute once, and the item is null
|
||||
allLoopSkipped := true
|
||||
for _, item := range e.dealLoop(had) {
|
||||
resSkip, exeErr := e.executeModule(ctx, e.task, item, h, &stdout, &stderr)
|
||||
if exeErr != nil || !resSkip {
|
||||
allLoopSkipped = false
|
||||
}
|
||||
if exeErr != nil {
|
||||
resErr = exeErr
|
||||
break
|
||||
}
|
||||
// loop execute once, skip task
|
||||
if item == nil && resSkip {
|
||||
stdout = modules.StdoutSkip
|
||||
return
|
||||
}
|
||||
}
|
||||
// when all loop skipped, skip task
|
||||
if allLoopSkipped {
|
||||
stdout = modules.StdoutSkip
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue