()
| 65 | } |
| 66 | |
| 67 | func (s ParallelScript) Cancel() error { |
| 68 | s.logger.Debug(s.logTag, "Canceling a parallel script") |
| 69 | existingScripts := s.findExistingScripts(s.allScripts) |
| 70 | for _, script := range existingScripts { |
| 71 | if script, ok := script.(CancellableScript); ok { |
| 72 | err := script.Cancel() |
| 73 | if err != nil { |
| 74 | return bosherr.WrapErrorf(err, "'%s' script did not cancel", s.name) |
| 75 | } |
| 76 | } else { |
| 77 | return bosherr.Errorf("Script %s is not cancellable", s.name) |
| 78 | } |
| 79 | } |
| 80 | return nil |
| 81 | } |
| 82 | |
| 83 | func (s ParallelScript) findExistingScripts(all []Script) []Script { |
| 84 | var existing []Script |
no test coverage detected