mirror of
https://github.com/ceph/ceph
synced 2025-02-23 11:07:35 +00:00
Python Ioctx.get_xattrs does not take xattr_name
Fixes bug 5528 Since it returns all xattrs, it does not take an xattr_name. Also, add unit tests for the Object xattrs methods. Signed-off-by: Johannes Erdfelt <johannes@erdfelt.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
This commit is contained in:
parent
d4ca36b317
commit
d8fe439260
@ -1566,9 +1566,9 @@ class Object(object):
|
||||
return self.ioctx.get_xattr(self.key, xattr_name)
|
||||
|
||||
@set_object_locator
|
||||
def get_xattrs(self, xattr_name):
|
||||
def get_xattrs(self):
|
||||
self.require_object_exists()
|
||||
return self.ioctx.get_xattrs(self.key, xattr_name)
|
||||
return self.ioctx.get_xattrs(self.key)
|
||||
|
||||
@set_object_locator
|
||||
def set_xattr(self, xattr_name, xattr_value):
|
||||
|
@ -117,6 +117,18 @@ class TestIoctx(object):
|
||||
stored_xattrs[key] = value
|
||||
eq(stored_xattrs, xattrs)
|
||||
|
||||
def test_obj_xattrs(self):
|
||||
xattrs = dict(a='1', b='2', c='3', d='a\0b', e='\0')
|
||||
self.ioctx.write('abc', '')
|
||||
obj = list(self.ioctx.list_objects())[0]
|
||||
for key, value in xattrs.iteritems():
|
||||
obj.set_xattr(key, value)
|
||||
eq(obj.get_xattr(key), value)
|
||||
stored_xattrs = {}
|
||||
for key, value in obj.get_xattrs():
|
||||
stored_xattrs[key] = value
|
||||
eq(stored_xattrs, xattrs)
|
||||
|
||||
def test_create_snap(self):
|
||||
assert_raises(ObjectNotFound, self.ioctx.remove_snap, 'foo')
|
||||
self.ioctx.create_snap('foo')
|
||||
|
Loading…
Reference in New Issue
Block a user