mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-06-03 01:44:53 +00:00
Do not skip /run when counting the size (#538)
(cherry picked from commit a6bf3541c5
)
This commit is contained in:
parent
4f2bc7732c
commit
e23d099a07
@ -823,12 +823,11 @@ func GetSourceSize(config *Config, source *v1.ImageSource) (int64, error) {
|
|||||||
hostDir = "/host"
|
hostDir = "/host"
|
||||||
}
|
}
|
||||||
err = fsutils.WalkDirFs(config.Fs, source.Value(), func(path string, d fs.DirEntry, err error) error {
|
err = fsutils.WalkDirFs(config.Fs, source.Value(), func(path string, d fs.DirEntry, err error) error {
|
||||||
|
|
||||||
// If its empty we are just not setting it, so probably out of the k8s upgrade path
|
// If its empty we are just not setting it, so probably out of the k8s upgrade path
|
||||||
if hostDir != "" && strings.HasPrefix(path, hostDir) {
|
if hostDir != "" && strings.HasPrefix(path, hostDir) {
|
||||||
config.Logger.Logger.Debug().Str("path", path).Str("hostDir", hostDir).Msg("Skipping file as it is a host directory")
|
config.Logger.Logger.Debug().Str("path", path).Str("hostDir", hostDir).Msg("Skipping file as it is a host directory")
|
||||||
} else if strings.HasPrefix(path, "/proc") || strings.HasPrefix(path, "/dev") || strings.HasPrefix(path, "/run") {
|
} else if strings.HasPrefix(path, "/proc") || strings.HasPrefix(path, "/dev") {
|
||||||
config.Logger.Logger.Debug().Str("path", path).Str("hostDir", hostDir).Msg("Skipping dir as it is a system directory (/proc, /dev or /run)")
|
config.Logger.Logger.Debug().Str("path", path).Str("hostDir", hostDir).Msg("Skipping dir as it is a runtime directory (/proc or /dev)")
|
||||||
} else {
|
} else {
|
||||||
v := getSize(&size, filesVisited, path, d, err)
|
v := getSize(&size, filesVisited, path, d, err)
|
||||||
return v
|
return v
|
||||||
|
Loading…
Reference in New Issue
Block a user