summaryrefslogtreecommitdiffstats
path: root/swift/1.4.8/plugins/utils.py
diff options
context:
space:
mode:
authorPeter Portante <peter.portante@redhat.com>2012-10-12 13:07:24 -0400
committerAnand Avati <avati@redhat.com>2012-10-13 10:40:41 -0700
commit49fad94c91bfba557d77e179bb020b70c0e18fbc (patch)
treec060faa928ee46cc494f792e835e5dfe6d4d23d6 /swift/1.4.8/plugins/utils.py
parenta9c613dfcfcb19299af00be4fc0d3b05dbd007d9 (diff)
Refactor to use pyxattr's get/set/remove methods
These methods are not deprecated, the old ones with the xattr suffix are considered deprecated starting with 0.4 of pyxattr. Change-Id: I86ba7a44cec81a273931bf7e470de5eb04e82663 BUG: 865858 Signed-off-by: Peter Portante <peter.portante@redhat.com> Reviewed-on: http://review.gluster.org/4077 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'swift/1.4.8/plugins/utils.py')
-rw-r--r--swift/1.4.8/plugins/utils.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/swift/1.4.8/plugins/utils.py b/swift/1.4.8/plugins/utils.py
index d8fc7a436..b282f42be 100644
--- a/swift/1.4.8/plugins/utils.py
+++ b/swift/1.4.8/plugins/utils.py
@@ -16,9 +16,9 @@
import logging
import os
import errno
+import xattr
from hashlib import md5
from swift.common.utils import normalize_timestamp
-from xattr import setxattr, removexattr, getxattr, removexattr
import cPickle as pickle
X_CONTENT_TYPE = 'Content-Type'
@@ -182,9 +182,9 @@ def do_setxattr(path, key, value):
fd = path
if fd or os.path.isdir(path):
try:
- setxattr(fd, key, value)
+ xattr.set(fd, key, value)
except Exception, err:
- logging.exception("setxattr failed on %s key %s err: %s", path, key, str(err))
+ logging.exception("xattr.set failed on %s key %s err: %s", path, key, str(err))
raise
finally:
if fd and not os.path.isdir(path):
@@ -204,10 +204,10 @@ def do_getxattr(path, key, log = True):
fd = path
if fd or os.path.isdir(path):
try:
- value = getxattr(fd, key)
+ value = xattr.get(fd, key)
except Exception, err:
if log:
- logging.exception("getxattr failed on %s key %s err: %s", path, key, str(err))
+ logging.exception("xattr.get failed on %s key %s err: %s", path, key, str(err))
raise
finally:
if fd and not os.path.isdir(path):
@@ -225,9 +225,9 @@ def do_removexattr(path, key):
fd = path
if fd or os.path.isdir(path):
try:
- removexattr(fd, key)
+ xattr.remove(fd, key)
except Exception, err:
- logging.exception("removexattr failed on %s key %s err: %s", path, key, str(err))
+ logging.exception("xattr.remove failed on %s key %s err: %s", path, key, str(err))
raise
finally:
if fd and not os.path.isdir(path):
@@ -313,9 +313,9 @@ def check_user_xattr(path):
return False
do_setxattr(path, 'user.test.key1', 'value1')
try:
- removexattr(path, 'user.test.key1')
+ xattr.remove(path, 'user.test.key1')
except Exception, err:
- logging.exception("removexattr failed on %s err: %s", path, str(err))
+ logging.exception("xattr.remove failed on %s err: %s", path, str(err))
#Remove xattr may fail in case of concurrent remove.
return True