Change in vdsm[master]: pytho3: libmodernize.fixes.fix_raise_six

danken at redhat.com danken at redhat.com
Fri Apr 24 12:16:27 UTC 2015


Dan Kenigsberg has uploaded a new change for review.

Change subject: pytho3: libmodernize.fixes.fix_raise_six
......................................................................

pytho3: libmodernize.fixes.fix_raise_six

This patch introduces a new dependency on the "six" module

Change-Id: I991be53a5321e7950badce44359dc4bd13f70b5b
Signed-off-by: Dan Kenigsberg <danken at redhat.com>
---
M configure.ac
M lib/vdsm/utils.py
M tests/utilsTests.py
M vdsm.spec.in
M vdsm/API.py
M vdsm/storage/storageServer.py
6 files changed, 12 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/14/40214/1

diff --git a/configure.ac b/configure.ac
index 0a30c3e..6d4662e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -275,6 +275,7 @@
 AX_PYTHON_MODULE([pthreading], [fatal])
 AX_PYTHON_MODULE([pyinotify], [fatal])
 AX_PYTHON_MODULE([selinux], [fatal])
+AX_PYTHON_MODULE([six], [fatal])
 
 # External programs (sorted, please keep in order)
 AC_PATH_PROG([BLKID_PATH], [blkid], [/sbin/blkid])
diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index c88a1d7..ad9a323 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -40,6 +40,7 @@
 import itertools
 import logging
 import re
+import six
 import sys
 import os
 import platform
@@ -1150,7 +1151,7 @@
                     undoExcInfo = sys.exc_info()
 
         if exc_type is None and undoExcInfo is not None:
-            raise undoExcInfo[0], undoExcInfo[1], undoExcInfo[2]
+            six.reraise(undoExcInfo[0], undoExcInfo[1], undoExcInfo[2])
 
     def defer(self, func, *args, **kwargs):
         self._finally.append((func, args, kwargs))
diff --git a/tests/utilsTests.py b/tests/utilsTests.py
index a5ecc11..1578480 100644
--- a/tests/utilsTests.py
+++ b/tests/utilsTests.py
@@ -24,6 +24,7 @@
 import errno
 import logging
 import os.path
+import six
 import sys
 import threading
 import time
@@ -541,7 +542,7 @@
         for worker in self.workers:
             if worker.exc_info:
                 t, v, tb = worker.exc_info
-                raise t, v, tb
+                six.reraise(t, v, tb)
 
     def read_stderr(self):
         args = ['if=/dev/zero',
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 25506cf..535e278 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -96,6 +96,7 @@
 BuildRequires: python-devel
 BuildRequires: python-netaddr
 BuildRequires: python-nose
+BuildRequires: python-six
 BuildRequires: rpm-build
 
 # BuildRequires needed by the tests during the build
@@ -155,6 +156,7 @@
 Requires: python-cpopen >= 1.3
 Requires: python-ioprocess >= 0.14
 Requires: python-pthreading >= 0.1.3-3
+Requires: python-six
 Requires: %{name}-infra = %{version}-%{release}
 Requires: rpm-python
 Requires: nfs-utils
diff --git a/vdsm/API.py b/vdsm/API.py
index 3cdc465..22e80e3 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -23,6 +23,7 @@
 from contextlib import contextmanager
 import os
 import signal
+import six
 import sys
 import time
 import logging
@@ -1574,7 +1575,7 @@
                     # exception that might have happened on rollback is
                     # properly logged and derived from actions to respond to
                     # the original exception.
-                    raise excType, value, tb
+                    six.reraise(excType, value, tb)
 
     def setSafeNetworkConfig(self):
         """Declare current network configuration as 'safe'"""
diff --git a/vdsm/storage/storageServer.py b/vdsm/storage/storageServer.py
index 22a90d1..4d08e1a 100644
--- a/vdsm/storage/storageServer.py
+++ b/vdsm/storage/storageServer.py
@@ -27,6 +27,7 @@
 from collections import namedtuple
 import misc
 from functools import partial
+import six
 import sys
 
 from vdsm.compat import pickle
@@ -216,7 +217,7 @@
             except OSError as e:
                 self.log.warn("Error removing mountpoint directory %r: %s",
                               self._getLocalPath(), e)
-            raise t, v, tb
+            six.reraise(t, v, tb)
         else:
             try:
                 fileSD.validateDirAccess(
@@ -227,7 +228,7 @@
                     self.disconnect()
                 except OSError:
                     self.log.exception("Error disconnecting")
-                raise t, v, tb
+                six.reraise(t, v, tb)
 
     def isConnected(self):
         return self._mount.isMounted()


-- 
To view, visit https://gerrit.ovirt.org/40214
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I991be53a5321e7950badce44359dc4bd13f70b5b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>


More information about the vdsm-patches mailing list