Skip to content

Commit

Permalink
Merge pull request #116 from utilitywarehouse/omit-out-on-err
Browse files Browse the repository at this point in the history
Omit output when apply fails
  • Loading branch information
ffilippopoulos authored Apr 22, 2020
2 parents 9adc839 + c380a0e commit c24b14c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion run/batch_applier.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ func (a *BatchApplier) Apply(applyList []string, options *ApplyOptions) ([]Apply
successes = append(successes, appliedFile)
log.Logger.Info(fmt.Sprintf("%v\n%v", cmd, output))
} else {
appliedFile.Output = "Apply output omitted on error in case of sensitive data\n"
appliedFile.ErrorMessage = err.Error()
failures = append(failures, appliedFile)
log.Logger.Warn(fmt.Sprintf("%v\n%v\n%v", cmd, output, appliedFile.ErrorMessage))
log.Logger.Warn(fmt.Sprintf("%v\n%v", cmd, appliedFile.ErrorMessage))
}

a.Metrics.UpdateNamespaceSuccess(path, success)
Expand Down
10 changes: 5 additions & 5 deletions run/batch_applier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ func TestBatchApplierApplyFail(t *testing.T) {
expectFailureMetric("file3", metrics),
)
failures := []ApplyAttempt{
{"file1", "cmd file1", "output file1", "error file1"},
{"file2", "cmd file2", "output file2", "error file2"},
{"file3", "cmd file3", "output file3", "error file3"},
{"file1", "cmd file1", "Apply output omitted on error in case of sensitive data\n", "error file1"},
{"file2", "cmd file2", "Apply output omitted on error in case of sensitive data\n", "error file2"},
{"file3", "cmd file3", "Apply output omitted on error in case of sensitive data\n", "error file3"},
}
tc := batchTestCase{
BatchApplier{
Expand Down Expand Up @@ -174,8 +174,8 @@ func TestBatchApplierApplyPartial(t *testing.T) {
{"file3", "cmd file3", "output file3", ""},
}
failures := []ApplyAttempt{
{"file2", "cmd file2", "output file2", "error file2"},
{"file4", "cmd file4", "output file4", "error file4"},
{"file2", "cmd file2", "Apply output omitted on error in case of sensitive data\n", "error file2"},
{"file4", "cmd file4", "Apply output omitted on error in case of sensitive data\n", "error file4"},
}
tc := batchTestCase{
BatchApplier{
Expand Down

0 comments on commit c24b14c

Please sign in to comment.