classes: rootfs-postcommands: avoid exception in overlayfs_qa_check

Message ID 20220224170010.26845-1-stefan.herbrechtsmeier-oss@weidmueller.com
State Accepted, archived
Commit 4396348c24efb1185d68876d3cf6ade90324dee5
Headers show
Series classes: rootfs-postcommands: avoid exception in overlayfs_qa_check | expand

Commit Message

Stefan Herbrechtsmeier Feb. 24, 2022, 5 p.m. UTC
From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

The overlayfs_qa_check in the rootfs-postcommands class throws an
exception if the overlayfs distro feature is enabled but no global
OVERLAYFS_MOUNT_POINT is specifived.

File: '/home/stefan/dalos-linutronix/poky/meta/classes/rootfs-postcommands.bbclass', lineno: 389, function: overlayfs_qa_check
     0385:    searchpaths = [oe.path.join(imagepath, d.getVar("sysconfdir"), "systemd", "system"),
     0386:                   oe.path.join(imagepath, d.getVar("systemd_system_unitdir"))]
     0387:
     0388:    allUnitExist = True;
 *** 0389:    for mountPoint in overlayMountPoints:
     0390:        path = d.getVarFlag('OVERLAYFS_MOUNT_POINT', mountPoint)
     0391:        unit = mountUnitName(path)
     0392:
     0393:        if not any(os.path.isfile(oe.path.join(dirpath, unit))
Exception: TypeError: 'NoneType' object is not iterable

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

---

 meta/classes/rootfs-postcommands.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass
index 74035c30b7..cd8986d8a9 100644
--- a/meta/classes/rootfs-postcommands.bbclass
+++ b/meta/classes/rootfs-postcommands.bbclass
@@ -380,7 +380,7 @@  python overlayfs_qa_check() {
     from oe.overlayfs import mountUnitName
 
     # this is a dumb check for unit existence, not its validity
-    overlayMountPoints = d.getVarFlags("OVERLAYFS_MOUNT_POINT")
+    overlayMountPoints = d.getVarFlags("OVERLAYFS_MOUNT_POINT") or {}
     imagepath = d.getVar("IMAGE_ROOTFS")
     searchpaths = [oe.path.join(imagepath, d.getVar("sysconfdir"), "systemd", "system"),
                    oe.path.join(imagepath, d.getVar("systemd_system_unitdir"))]