[PATCH RHEL 7.6 LP] RHEL 7.6 LP: Convert Python 3 to Python 2.
Nir, can you confirm this is correct for RHEL 7 / Python 2? Rich.
From: "Richard W.M. Jones" <rjones@redhat.com> Updates commit 8f250c00c8b028a614815f63b2713748504d7ef9 for RHEL 7.6 LP. --- v2v/rhv-upload-plugin.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py index 42c7065..3e561e6 100644 --- a/v2v/rhv-upload-plugin.py +++ b/v2v/rhv-upload-plugin.py @@ -383,8 +383,9 @@ def pwrite(h, buf, offset): try: http.send(buf) - except BrokenPipeError: - pass + except socket.error as e: + if e.args[0] not in (errno.EPIPE, errno.ESHUTDOWN): + raise r = http.getresponse() if r.status != 200: @@ -446,8 +447,9 @@ def emulate_zero(h, count, offset): http.send(buf) count -= len(buf) http.send(buffer(buf, 0, count)) - except BrokenPipeError: - pass + except socket.error as e: + if e.args[0] not in (errno.EPIPE, errno.ESHUTDOWN): + raise r = http.getresponse() if r.status != 200: -- 1.8.3.1
On Wed, Aug 29, 2018 at 12:22 AM Richard W.M. Jones <rjones@redhat.com> wrote:
From: "Richard W.M. Jones" <rjones@redhat.com>
Updates commit 8f250c00c8b028a614815f63b2713748504d7ef9 for RHEL 7.6 LP. --- v2v/rhv-upload-plugin.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py index 42c7065..3e561e6 100644 --- a/v2v/rhv-upload-plugin.py +++ b/v2v/rhv-upload-plugin.py @@ -383,8 +383,9 @@ def pwrite(h, buf, offset):
try: http.send(buf) - except BrokenPipeError: - pass + except socket.error as e: + if e.args[0] not in (errno.EPIPE, errno.ESHUTDOWN): + raise
r = http.getresponse() if r.status != 200: @@ -446,8 +447,9 @@ def emulate_zero(h, count, offset): http.send(buf) count -= len(buf) http.send(buffer(buf, 0, count)) - except BrokenPipeError: - pass + except socket.error as e: + if e.args[0] not in (errno.EPIPE, errno.ESHUTDOWN): + raise
r = http.getresponse() if r.status != 200: -- 1.8.3.1
Looks correct. Nir
participants (2)
-
Nir Soffer -
Richard W.M. Jones