Change in vdsm[master]: gluster: Handling Attribute error in Python 2.6

avishwan at redhat.com avishwan at redhat.com
Wed Mar 6 09:11:59 UTC 2013


Aravinda VK has uploaded a new change for review.

Change subject: gluster: Handling Attribute error in Python 2.6
......................................................................

gluster: Handling Attribute error in Python 2.6

xml.etree.cElementTree in Python 2.6 doesn't have the attribute
ParseError(Introduced in Python 2.7). VDSM gluster/cli.py tries
to capture etree.ParseError when gluster cli returns incompatible
xml output.

Change-Id: I63c33b34ce11473636365ea094e267c5424c7255
Signed-off-by: Aravinda VK <avishwan at redhat.com>
---
M vdsm/gluster/cli.py
1 file changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/52/12752/1

diff --git a/vdsm/gluster/cli.py b/vdsm/gluster/cli.py
index a3950fc..5a10b0e 100644
--- a/vdsm/gluster/cli.py
+++ b/vdsm/gluster/cli.py
@@ -85,7 +85,7 @@
         tree = etree.fromstring('\n'.join(out))
         rv = int(tree.find('opRet').text)
         msg = tree.find('opErrstr').text
-    except (etree.ParseError, AttributeError, ValueError):
+    except:
         raise ge.GlusterXmlErrorException(err=out)
     if rv == 0:
         return tree
@@ -303,7 +303,7 @@
             return _parseVolumeStatusMem(xmltree)
         else:
             return _parseVolumeStatus(xmltree)
-    except (etree.ParseError, AttributeError, ValueError):
+    except:
         raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
 
 
@@ -427,7 +427,7 @@
         raise ge.GlusterVolumesListFailedException(rc=e.rc, err=e.err)
     try:
         return _parseVolumeInfo(xmltree)
-    except (etree.ParseError, AttributeError, ValueError):
+    except:
         raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
 
 
@@ -448,7 +448,7 @@
         raise ge.GlusterVolumeCreateFailedException(rc=e.rc, err=e.err)
     try:
         return {'uuid': xmltree.find('volCreate/volume/id').text}
-    except (etree.ParseError, AttributeError, ValueError):
+    except:
         raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
 
 
@@ -787,7 +787,7 @@
         return _parsePeerStatus(xmltree,
                                 _getLocalIpAddress() or _getGlusterHostName(),
                                 _getGlusterUuid(), HostStatus.CONNECTED)
-    except (etree.ParseError, AttributeError, ValueError):
+    except:
         raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
 
 
@@ -878,5 +878,5 @@
         raise ge.GlusterVolumeProfileInfoFailedException(rc=e.rc, err=e.err)
     try:
         return _parseVolumeProfileInfo(xmltree, nfs)
-    except (etree.ParseError, AttributeError, ValueError):
+    except:
         raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])


--
To view, visit http://gerrit.ovirt.org/12752
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I63c33b34ce11473636365ea094e267c5424c7255
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Aravinda VK <avishwan at redhat.com>


More information about the vdsm-patches mailing list