Fix Python3 compatibility for exceptions in libvirt_driver
@@ -157,14 +157,14 @@ class LibvirtNodeDriver(NodeDriver):
try:
self.connection = libvirt.open(uri)
except Exception as exc:
- if 'Could not resolve' in exc.message:
+ if 'Could not resolve' in str(exc):
raise Exception("Make sure hostname is accessible")
- if 'Connection refused' in exc.message:
+ if 'Connection refused' in str(exc):
raise Exception("Make sure hostname is accessible and libvirt "
"is running")
- if 'Permission denied' in exc.message:
+ if 'Permission denied' in str(exc):
raise Exception("Make sure ssh key and username are valid")
- if 'End of file while reading data' in exc.message:
+ if 'End of file while reading data' in str(exc):
raise Exception("Make sure libvirt is running and user %s is "
"authorised to connect" % user)
raise Exception("Connection error")
