Skip to content

Commit

Permalink
fix(events/k8saudit): correct misplaced reader when loading YAMLs
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Grasso <[email protected]>
  • Loading branch information
leogr authored and poiana committed Apr 24, 2020
1 parent ae981be commit 4a1520b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions events/k8saudit/yaml_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ func init() {
// The filename must be in the dash-case format,
// so it will be converted to CamelCase and used as action's name.
fileName := n
fileContent := b
name := strcase.ToCamel(strings.TrimSuffix(fileName, filepath.Ext(fileName)))
actionName := "k8saudit." + name

reader := bytes.NewReader(b)
events.RegisterWithName(func(h events.Helper) error {
count := 0
r := h.ResourceBuilder().
Unstructured().
// Schema(schema). // todo(leogr): do we need this?
ContinueOnError().
Stream(reader, fileName).
Stream(bytes.NewReader(fileContent), fileName).
Flatten().
Do()
if err := r.Err(); err != nil {
Expand Down

0 comments on commit 4a1520b

Please sign in to comment.