← Back to team overview

openstack team mailing list archive

Problems with path, prefix and delimiter with Object Storage

 

Hello,

We're having problems with the behaviour of path, prefix and delimiter
parameters when calling list_objects, get_objects, etc; using
python-cloudfiles and the Bexar release.

I'm asking here because we don't know if this is a bug or the
documentation is wrong [1].

We're dealing with pseudo-hierarchical folders/directories, and when
setting path we're not getting pseudo-directories (as the documentation
seems to suggest with the given example).

We're trying the following case:

test/a/b/c.txt
test/a/b/a.txt
test/a/b.txt
test/a.txt

That means: 4 files, and 2 different pseudo-directories (using test/ as
root for the tests).

a. list_objects(prefix='test/')

 ['test/a.txt', 'test/a/b.txt', 'test/a/b/a.txt', 'test/a/b/c.txt']

4 files, as expected.

b. list_objects(prefix='test/', delimiter='/')

 ['test/a.txt', 'test/a/']

1 file and 1 pseudo-directory, as you can see with 'subdir':

c.list_objects_info(prefix='test/', delimiter='/')

 [{u'bytes': 13, u'last_modified': u'2011-03-17T11:46:03.596480',
u'hash': u'e6a394bb2cdb1a7b044b37a48e024b2c', u'name': u'test/a.txt',
u'content_type': u'text/plain'}, {u'subdir': u'test/a/'}]

c. list_objects(path='test')

 ['test/a.txt']

It's not returning any pseudo-directory (and according to common/db.py
it can't).

So our problem is 'path' query parameter. Is this the expected behaviour
or is it a bug?

Note: checking the code, path implies that prefix=path and
delimiter='/'; and path won't return any pseudo-directories as shown in
b).

If someone can explain the path behaviour maybe we should provide a
patch for the documentation, or submit a bug. Thanks!

Kind regards,

Juan

[1]:
http://docs.openstack.org/openstack-object-storage/developer/content/ch03s02.html#d5e407

-- 
Juan J. Martínez
Development, MEMSET

mail: juan@xxxxxxxxxx
 web: http://www.memset.com/

Memset Ltd., registration number 4504980. 25 Frederick Sanger Road, Guildford, Surrey, GU2 7YD, UK.




Follow ups