mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-25 21:39:10 +00:00
Merge branch 'CNT-3965/dont-fail-chmod-hook' into 'main'
Skip paths with errors in chmod hook See merge request nvidia/container-toolkit/container-toolkit!303
This commit is contained in:
commit
06d8bb5019
@ -18,6 +18,7 @@ package chmod
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
@ -133,7 +134,12 @@ func (m command) run(c *cli.Context, cfg *config) error {
|
|||||||
func (m command) getPaths(root string, paths []string) []string {
|
func (m command) getPaths(root string, paths []string) []string {
|
||||||
var pathsInRoot []string
|
var pathsInRoot []string
|
||||||
for _, f := range paths {
|
for _, f := range paths {
|
||||||
pathsInRoot = append(pathsInRoot, filepath.Join(root, f))
|
path := filepath.Join(root, f)
|
||||||
|
if _, err := os.Stat(path); err != nil {
|
||||||
|
m.logger.Debugf("Skipping path %q: %v", path, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
pathsInRoot = append(pathsInRoot, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
return pathsInRoot
|
return pathsInRoot
|
||||||
|
Loading…
Reference in New Issue
Block a user