Change in vdsm[master]: gluster: fix hook list error if magic.MIME_TYPE not supported.
tjeyasin at redhat.com
tjeyasin at redhat.com
Thu Oct 24 05:48:38 UTC 2013
Hello Ayal Baron, Bala.FA, Saggi Mizrahi, Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/20481
to review the following change.
Change subject: gluster: fix hook list error if magic.MIME_TYPE not supported.
......................................................................
gluster: fix hook list error if magic.MIME_TYPE not supported.
Enhance _getMimeType function to
fix hook list error if any lower version of python-magic
does not support magic.MIME_TYPE
Change-Id: I5deff2b7ad70321d97823d4e62f76c309aa5bc3e
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1018076
Signed-off-by: Timothy Asir <tjeyasin at redhat.com>
---
M vdsm/gluster/hooks.py
1 file changed, 5 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/81/20481/1
diff --git a/vdsm/gluster/hooks.py b/vdsm/gluster/hooks.py
index 914d09d..e1f0a79 100644
--- a/vdsm/gluster/hooks.py
+++ b/vdsm/gluster/hooks.py
@@ -51,7 +51,11 @@
def _getMimeType(fileName):
global _mimeType
if not _mimeType:
- _mimeType = magic.open(magic.MIME_TYPE)
+ if hasattr(magic, "MIME_TYPE"):
+ _mimeType = magic.open(magic.MIME_TYPE)
+ else:
+ _mimeType = magic.open(magic.MAGIC_NONE)
+ _mimeType.setflags(magic.MAGIC_MIME)
_mimeType.load()
return _mimeType.file(fileName)
--
To view, visit http://gerrit.ovirt.org/20481
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5deff2b7ad70321d97823d4e62f76c309aa5bc3e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Timothy Asir <tjeyasin at redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron at redhat.com>
Gerrit-Reviewer: Bala.FA <barumuga at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi at redhat.com>
More information about the vdsm-patches
mailing list