From 50017c39a2babeddc41053fe8dbc78132157face Mon Sep 17 00:00:00 2001 From: Thorsten Klein Date: Fri, 11 Oct 2019 11:42:24 +0200 Subject: [PATCH] include subdirectories for auto-deploy manifests --- pkg/deploy/controller.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pkg/deploy/controller.go b/pkg/deploy/controller.go index 261ab33de8..f768c092d7 100644 --- a/pkg/deploy/controller.go +++ b/pkg/deploy/controller.go @@ -85,10 +85,14 @@ func (w *watcher) listFiles(force bool) error { } func (w *watcher) listFilesIn(base string, force bool) error { - files, err := ioutil.ReadDir(base) - if os.IsNotExist(err) { + files := map[string]os.FileInfo{} + if err := filepath.Walk(base, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + files[path] = info return nil - } else if err != nil { + }); err != nil { return err } @@ -100,13 +104,12 @@ func (w *watcher) listFilesIn(base string, force bool) error { } var errs []error - for _, file := range files { + for path, file := range files { if skipFile(file.Name(), skips) { continue } - p := filepath.Join(base, file.Name()) - if err := w.deploy(p, !force); err != nil { - errs = append(errs, errors2.Wrapf(err, "failed to process %s", p)) + if err := w.deploy(path, !force); err != nil { + errs = append(errs, errors2.Wrapf(err, "failed to process %s", path)) } }