Blame SOURCES/0029-python-semanage-fix-moduleRecords.customized.patch

9bbebd
From 7cc31c4799dd94ed516a39d853744bd1ffb6dc69 Mon Sep 17 00:00:00 2001
9bbebd
From: Vit Mojzis <vmojzis@redhat.com>
9bbebd
Date: Mon, 30 Sep 2019 09:49:04 +0200
9bbebd
Subject: [PATCH] python/semanage: fix moduleRecords.customized()
9bbebd
9bbebd
Return value of "customized" has to be iterable.
9bbebd
9bbebd
Fixes:
9bbebd
   "semanage export" with no modules in the system (eg. monolithic policy)
9bbebd
   crashes:
9bbebd
9bbebd
   Traceback (most recent call last):
9bbebd
     File "/usr/sbin/semanage", line 970, in <module>
9bbebd
       do_parser()
9bbebd
     File "/usr/sbin/semanage", line 949, in do_parser
9bbebd
       args.func(args)
9bbebd
     File "/usr/sbin/semanage", line 771, in handleExport
9bbebd
       for c in OBJECT.customized():
9bbebd
   TypeError: 'NoneType' object is not iterable
9bbebd
9bbebd
Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
9bbebd
---
9bbebd
 python/semanage/seobject.py | 2 +-
9bbebd
 1 file changed, 1 insertion(+), 1 deletion(-)
9bbebd
9bbebd
diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py
9bbebd
index 3959abc8..16edacaa 100644
9bbebd
--- a/python/semanage/seobject.py
9bbebd
+++ b/python/semanage/seobject.py
9bbebd
@@ -380,7 +380,7 @@ class moduleRecords(semanageRecords):
9bbebd
     def customized(self):
9bbebd
         all = self.get_all()
9bbebd
         if len(all) == 0:
9bbebd
-            return
9bbebd
+            return []
9bbebd
         return ["-d %s" % x[0] for x in [t for t in all if t[1] == 0]]
9bbebd
 
9bbebd
     def list(self, heading=1, locallist=0):
9bbebd
-- 
9bbebd
2.21.0
9bbebd