no error if images for containers don't exist

Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
Christian Goll
2023-10-06 16:00:20 +02:00
committed by Jonathon Anderson
parent 807b38f1c9
commit 951dd13866
2 changed files with 4 additions and 9 deletions

View File

@@ -103,6 +103,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- During node discovery, prefer the primary network interface, if defined. #775
- added general test framework which creates temporary directories on the fly
- only write IPMI if write is true
- Don't show an error if image files for containers can't be found. #933
## [4.4.0] 2023-01-18

View File

@@ -330,9 +330,7 @@ func ContainerList() (containerInfo []*wwapiv1.ContainerInfo, err error) {
}
var modTime uint64
imageStat, err := os.Stat(container.ImageFile(source))
if err != nil {
wwlog.Error("%s\n", err)
} else {
if err == nil {
modTime = uint64(imageStat.ModTime().Unix())
}
size, err := util.DirSize(container.SourceDir(source))
@@ -340,15 +338,11 @@ func ContainerList() (containerInfo []*wwapiv1.ContainerInfo, err error) {
wwlog.Error("%s\n", err)
}
imgSize, err := os.Stat(container.ImageFile(source))
if err != nil {
wwlog.Error("%s\n", err)
} else {
if err == nil {
size += imgSize.Size()
}
imgSize, err = os.Stat(container.ImageFile(source) + ".gz")
if err != nil {
wwlog.Error("%s\n", err)
} else {
if err == nil {
size += imgSize.Size()
}