diff mbox series

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

Message ID 20201223135837.686676-1-mark.d.gray@redhat.com
State Changes Requested
Headers show
Series [ovs-dev] ovs-monitor-ipsec: Fix _nss_clear_database() parse error | expand

Commit Message

Mark Gray Dec. 23, 2020, 1:58 p.m. UTC
_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@redhat.com>
---
 ipsec/ovs-monitor-ipsec.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

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: