react on the error accordingly
This commit is contained in:
@@ -293,14 +293,19 @@ func ContainerList() (containerInfo []*wwapiv1.ContainerInfo, err error) {
|
|||||||
|
|
||||||
wwlog.Debug("Finding kernel version for: %s", source)
|
wwlog.Debug("Finding kernel version for: %s", source)
|
||||||
kernelVersion := container.KernelVersion(source)
|
kernelVersion := container.KernelVersion(source)
|
||||||
|
var creationTime uint64
|
||||||
creationTime, err := os.Stat(container.SourceDir(source))
|
sourceStat, err := os.Stat(container.SourceDir(source))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wwlog.Error("%s\n", err)
|
wwlog.Error("%s\n", err)
|
||||||
|
} else {
|
||||||
|
creationTime = uint64(sourceStat.ModTime().Unix())
|
||||||
}
|
}
|
||||||
modTime, err := os.Stat(container.ImageFile(source))
|
var modTime uint64
|
||||||
|
imageStat, err := os.Stat(container.ImageFile(source))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wwlog.Error("%s\n", err)
|
wwlog.Error("%s\n", err)
|
||||||
|
} else {
|
||||||
|
modTime = uint64(imageStat.ModTime().Unix())
|
||||||
}
|
}
|
||||||
size, err := util.DirSize(container.SourceDir(source))
|
size, err := util.DirSize(container.SourceDir(source))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -309,20 +314,22 @@ func ContainerList() (containerInfo []*wwapiv1.ContainerInfo, err error) {
|
|||||||
imgSize, err := os.Stat(container.ImageFile(source))
|
imgSize, err := os.Stat(container.ImageFile(source))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wwlog.Error("%s\n", err)
|
wwlog.Error("%s\n", err)
|
||||||
|
} else {
|
||||||
|
size += imgSize.Size()
|
||||||
}
|
}
|
||||||
size += imgSize.Size()
|
|
||||||
imgSize, err = os.Stat(container.ImageFile(source) + ".gz")
|
imgSize, err = os.Stat(container.ImageFile(source) + ".gz")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wwlog.Error("%s\n", err)
|
wwlog.Error("%s\n", err)
|
||||||
|
} else {
|
||||||
|
size += imgSize.Size()
|
||||||
}
|
}
|
||||||
size += imgSize.Size()
|
|
||||||
|
|
||||||
containerInfo = append(containerInfo, &wwapiv1.ContainerInfo{
|
containerInfo = append(containerInfo, &wwapiv1.ContainerInfo{
|
||||||
Name: source,
|
Name: source,
|
||||||
NodeCount: uint32(nodemap[source]),
|
NodeCount: uint32(nodemap[source]),
|
||||||
KernelVersion: kernelVersion,
|
KernelVersion: kernelVersion,
|
||||||
CreateDate: uint64(creationTime.ModTime().Unix()),
|
CreateDate: creationTime,
|
||||||
ModDate: uint64(modTime.ModTime().Unix()),
|
ModDate: modTime,
|
||||||
Size: uint64(size),
|
Size: uint64(size),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user