From 33769a991b40c6c2605f21a712596aa52cc2fddf Mon Sep 17 00:00:00 2001 From: Sven Walter Date: Tue, 4 Jul 2017 12:30:42 +0200 Subject: [PATCH] ignore empty files --- pkg/api/render.go | 7 +++++++ pkg/api/test-fixtures/repos/foobar/master/k8s/empty.yaml | 0 2 files changed, 7 insertions(+) create mode 100644 pkg/api/test-fixtures/repos/foobar/master/k8s/empty.yaml diff --git a/pkg/api/render.go b/pkg/api/render.go index a267d4f..b7c6b4c 100644 --- a/pkg/api/render.go +++ b/pkg/api/render.go @@ -39,6 +39,13 @@ func (app *App) Render(fetched *FetchResult) ([]runtime.Object, error) { continue } + if strings.TrimSpace(data) == "" { + log.WithFields(log.Fields{ + "Name": name, + }).Debug("Ignoring empty file.") + continue + } + obj, _, err := decode([]byte(data), nil, nil) if err != nil { return nil, errors.Wrapf(err, "unable to decode file '%s'", name) diff --git a/pkg/api/test-fixtures/repos/foobar/master/k8s/empty.yaml b/pkg/api/test-fixtures/repos/foobar/master/k8s/empty.yaml new file mode 100644 index 0000000..e69de29