libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clemens Wolff (JIRA)" <j...@apache.org>
Subject [jira] [Created] (LIBCLOUD-1043) Azure Storage driver crashes when passed a non file-like iterator
Date Fri, 17 May 2019 18:05:00 GMT
Clemens Wolff created LIBCLOUD-1043:
---------------------------------------

             Summary: Azure Storage driver crashes when passed a non file-like iterator
                 Key: LIBCLOUD-1043
                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-1043
             Project: Libcloud
          Issue Type: Bug
            Reporter: Clemens Wolff


The azure_blobs implementation of {{upload_object_via_stream(iterator, ...)}} currently assumes
that the passed-in iterator always is a file-like object that implements {{seek(...)}} ([source|https://github.com/apache/libcloud/blob/a1f9897ce107eb1b01674262ca1b9ff1f91d46f0/libcloud/storage/drivers/azure_blobs.py#L828-L830]).

This means that function crashes when used with arbitrary iterators as returned by {{iter(...)}}.

Notably, the libcloud integration for django-storages exercises this functionality ([source|https://github.com/jschneier/django-storages/blob/b441b74a17a46eb87ee4b10f60774b9a080c0fe1/storages/backends/apache_libcloud.py#L158])
which makes django-storages + libcloud + Azure Blobs currently unusable. See detailed stacktrace
below:

{code:python}
Traceback (most recent call last):
  File ".../app/manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "...\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "...\lib\site-packages\django\core\management\__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "...\lib\site-packages\django\core\management\base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "...\lib\site-packages\django\core\management\base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "...\lib\site-packages\django\contrib\staticfiles\management\commands\collectstatic.py",
line 188, in handle
    collected = self.collect()
  File "...\lib\site-packages\django\contrib\staticfiles\management\commands\collectstatic.py",
line 114, in collect
    handler(path, prefixed_path, storage)
  File "...\lib\site-packages\django\contrib\staticfiles\management\commands\collectstatic.py",
line 353, in copy_file
    self.storage.save(prefixed_path, source_file)
  File "...\lib\site-packages\django\core\files\storage.py", line 49, in save
    return self._save(name, content)
  File "...\lib\site-packages\storages\backends\apache_libcloud.py", line 157, in _save
    self.driver.upload_object_via_stream(iter(file), self._get_bucket(), name)
  File "...\lib\site-packages\libcloud\storage\drivers\azure_blobs.py", line 828, in upload_object_via_stream
    iterator.seek(0, os.SEEK_END)
AttributeError: 'generator' object has no attribute 'seek'
{code}




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message