Skip to content

Commit

Permalink
#134 Improve success condition to handle empty slice (#135)
Browse files Browse the repository at this point in the history
Signed-off-by: Garrett Leber <[email protected]>
  • Loading branch information
tcpkump authored Jun 18, 2024
1 parent 634f5d8 commit 414786a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions puppetreport/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,13 @@ func (r runReport) success() bool {
if !r.TransactionCompleted {
return false
}
var failed, ok int
var failed int
for _, item := range r.ResourceStatuses {
if item.Failed {
failed++
} else {
ok++
}
}
return ok > 0 && failed == 0
return failed == 0
}

type resourceStatus struct {
Expand Down

0 comments on commit 414786a

Please sign in to comment.