Blame SOURCES/BZ_1582458-Python-plugin-runner-don-t-print-socket-error-to-sys.patch

8b5823
From 4c87bf280d7d2a0bdb101d1d3d61cd1acfa71c5f Mon Sep 17 00:00:00 2001
8b5823
From: Gris Ge <fge@redhat.com>
8b5823
Date: Tue, 26 Jun 2018 01:10:33 +0800
8b5823
Subject: [PATCH] Python plugin runner: don't print socket error to syslog.
8b5823
8b5823
Treat socket.error as client went away if plugin is registered.
8b5823
8b5823
Fixing bug: https://bugzilla.redhat.com/show_bug.cgi?id=1582458
8b5823
8b5823
Signed-off-by: Gris Ge <fge@redhat.com>
8b5823
---
8b5823
 python_binding/lsm/_pluginrunner.py | 7 +++++++
8b5823
 1 file changed, 7 insertions(+)
8b5823
8b5823
diff --git a/python_binding/lsm/_pluginrunner.py b/python_binding/lsm/_pluginrunner.py
8b5823
index 0b52e95a..f2642f2e 100644
8b5823
--- a/python_binding/lsm/_pluginrunner.py
8b5823
+++ b/python_binding/lsm/_pluginrunner.py
8b5823
@@ -20,6 +20,7 @@
8b5823
 from lsm import LsmError, error, ErrorNumber
8b5823
 from lsm.lsmcli import cmd_line_wrapper
8b5823
 import six
8b5823
+import errno
8b5823
 
8b5823
 from lsm._common import SocketEOF as _SocketEOF
8b5823
 from lsm._transport import TransPort
8b5823
@@ -137,6 +138,12 @@ def run(self):
8b5823
             # occurring.
8b5823
             if need_shutdown:
8b5823
                 error('Client went away, exiting plug-in')
8b5823
+        except socket.error as se:
8b5823
+            if se.errno == errno.EPIPE:
8b5823
+                error('Client went away, exiting plug-in')
8b5823
+            else:
8b5823
+                error("Unhandled exception in plug-in!\n" +
8b5823
+                      traceback.format_exc())
8b5823
         except Exception:
8b5823
             error("Unhandled exception in plug-in!\n" + traceback.format_exc())
8b5823
 
8b5823
-- 
8b5823
2.18.0
8b5823