fix(scheduledtask): fix deletedResource task (#19428)

Co-authored-by: 马鸿飞 <mahongfei@yunion.cn>
This commit is contained in:
gouqi11
2024-02-04 10:42:53 +08:00
committed by GitHub
co-authored by 马鸿飞
parent 9efb34f7c7
commit b2de0282f6
@@ -442,6 +442,11 @@ func (st *SScheduledTask) Execute(ctx context.Context, userCred mcclient.TokenCr
if err != nil {
return err
}
if len(res) == 0 {
reason := fmt.Sprintf("All %ss %s failed:\n%s", st.ResourceType, st.Operation, errors.ErrNotFound)
sa.Fail(reason)
return nil
}
for id := range res {
ids = append(ids, id)
}