Skip to content

Commit

Permalink
fix(executor): Always check if resource has been deleted in checkReso…
Browse files Browse the repository at this point in the history
…urceState() (#4738)

Signed-off-by: terrytangyuan terrytangyuan@gmail.com
Co-authored-by: merlintang tangrock@gmail.com
  • Loading branch information
terrytangyuan authored and simster7 committed Dec 15, 2020
1 parent 739af45 commit 4059820
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions workflow/executor/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ func checkResourceState(resourceNamespace string, resourceName string, successRe
}()

for {
if checkIfResourceDeleted(resourceName, resourceNamespace) {
return false, errors.Errorf(errors.CodeNotFound, "Resource %s in namespace %s has been deleted somehow.", resourceName, resourceNamespace)
}

jsonBytes, err := readJSON(reader)

if err != nil {
Expand Down Expand Up @@ -254,10 +258,6 @@ func checkResourceState(resourceNamespace string, resourceName string, successRe
return true, resultErr
}

if checkIfResourceDeleted(resourceName, resourceNamespace) {
return false, errors.Errorf(errors.CodeNotFound, "Resource %s in namespace %s has been deleted somehow.", resourceName, resourceNamespace)
}

log.Info(string(jsonBytes))
ls := gjsonLabels{json: jsonBytes}
for _, req := range failReqs {
Expand Down

0 comments on commit 4059820

Please sign in to comment.