[ovs-dev] [PATCH] ovs-monitor-ipsec: Fix _nss_clear_database() parse error

Mark Gray mark.d.gray at redhat.com
Wed Dec 23 13:58:37 UTC 2020


_nss_clear_database() runs `certutil` in order to get a list
of certificates currently loaded in NSS. This fails with error:

"ovs-monitor-ipsec | ERR | Failed to clear NSS database.
startswith first arg must be bytes or a tuple of bytes, not str"

Modify subprocess.Popen() to write in 'text' mode so that
'startwith' can correctly parse output.

Signed-off-by: Mark Gray <mark.d.gray at redhat.com>
---
 ipsec/ovs-monitor-ipsec.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ipsec/ovs-monitor-ipsec.in b/ipsec/ovs-monitor-ipsec.in
index b84608a55d8a..903e6bc4aaf0 100755
--- a/ipsec/ovs-monitor-ipsec.in
+++ b/ipsec/ovs-monitor-ipsec.in
@@ -657,7 +657,8 @@ conn prevent_unencrypted_vxlan
             proc = subprocess.Popen(['certutil', '-L', '-d',
                                     'sql:/etc/ipsec.d/'],
                                     stdout=subprocess.PIPE,
-                                    stderr=subprocess.PIPE)
+                                    stderr=subprocess.PIPE,
+                                    text=True)
             lines = proc.stdout.readlines()
 
             for line in lines:
-- 
2.26.2



More information about the dev mailing list