mirror of https://github.com/k3s-io/k3s
Follow directory symlinks in auto deploying manifests (#9288)
Signed-off-by: Robert Rose <robert.rose@mailbox.org>
(cherry picked from commit 6886c0977f
)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
pull/10288/head
parent
23e87f2521
commit
8a7b0b75fe
|
@ -119,6 +119,26 @@ func (w *watcher) listFilesIn(base string, force bool) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Descend into symlinked directories, however, only top-level links are followed
|
||||
if info.Mode()&os.ModeSymlink != 0 {
|
||||
linkInfo, err := os.Stat(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if linkInfo.IsDir() {
|
||||
evalPath, err := filepath.EvalSymlinks(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
filepath.Walk(evalPath, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
files[path] = info
|
||||
return nil
|
||||
})
|
||||
}
|
||||
}
|
||||
files[path] = info
|
||||
return nil
|
||||
}); err != nil {
|
||||
|
|
Loading…
Reference in New Issue