libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Quentin Pradet (JIRA)" <>
Subject [jira] [Commented] (LIBCLOUD-986) List / Iterate container with prefix for Azure Blob service (This support exists in the other drivers already)
Date Wed, 21 Mar 2018 07:05:00 GMT


Quentin Pradet commented on LIBCLOUD-986:

The first thing to do would be to run the tests locally:

 * git clone
 * cd libcloud
 * pip install -r requirements-test.txt
 * cp libcloud/test/ libcloud/test/
 * pytest

When you'll be working on the Azure Blobs tests, running `pytest -k azure_blobs` will be faster.

The next step is to understand how the test fixtures work. Here's an example for another driver:

Next we'll need to write a test that fails without your changes, and succeeds with your changes.
Try to come up with a way to do this.

If you're stuck, make sure to ask questions!

> List / Iterate container with prefix for Azure Blob service (This support exists in the
other drivers already)
> --------------------------------------------------------------------------------------------------------------
>                 Key: LIBCLOUD-986
>                 URL:
>             Project: Libcloud
>          Issue Type: Improvement
>          Components: Storage
>            Reporter: Joshua Hawkinson
>            Priority: Major
> While testing out the libcloud storage abstraction I've come across a curious omission
in driver support. It seems that for many drivers there is additional support for the {{list_container_objects()}} and
{{iterate_container_objects()}} to support a prefix (or {{ex_prefix)}}. 
> This functionality is not present in the Azure driver for some reason.   I've gone
and checked the list_blobs API and it also supports this functionality as seen here:
> []
> I've attempted a quick and dirty patch that seems to work as well.
> {code}
> Line 384
> -    def iterate_container_objects(self, container):
> +    def iterate_container_objects(self, container, ex_prefix=None):
>         """
>         @inherits: :class:`StorageDriver.iterate_container_objects`
>         """
>         params = {'restype': 'container',
>                   'comp': 'list',
> +                  'prefix': ex_prefix,
>                   'maxresults': RESPONSES_PER_REQUEST,
>                   'include': 'metadata'}
> Line 419 (Add new function)
>     def list_container_objects(self, container, ex_prefix=None):
>         """
>         Return a list of objects for the given container.
>         :param container: Container instance.
>         :type container: :class:`Container`
>         :param ex_prefix: Only return objects starting with ex_prefix
>         :type ex_prefix: ``str``
>         :return: A list of Object instances.
>         :rtype: ``list`` of :class:`Object`
>         """
>         return list(self.iterate_container_objects(container,
>                                                    ex_prefix=ex_prefix))
>  {code}
> I've just worked around this at a higher level for now. There isn't any urgency on my
end,  but it would be nice if the abstraction was more consistent so I could remove the workaround

This message was sent by Atlassian JIRA

View raw message