Uploaded image for project: 'Libcloud'
  1. Libcloud
  2. LIBCLOUD-959

AZURE_BLOBS upload_object fails on both Container and Driver

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Storage
    • Labels:
      None
    • Environment:

      Python 2.7.11

      Description

      The upload_object method on both the driver and container objects fails for Provider.AZURE_BLOBS. Listing containers and objects works.

      > pip list
      Package         Version
      --------------- ---------
      apache-libcloud 2.2.1
      asn1crypto      0.23.0
      certifi         2017.11.5
      cffi            1.11.2
      chardet         3.0.4
      cryptography    2.1.3
      enum34          1.1.6
      idna            2.6
      ipaddress       1.0.18
      pip             9.0.1
      pycparser       2.18
      pyOpenSSL       17.3.0
      requests        2.18.4
      setuptools      36.6.0
      six             1.11.0
      urllib3         1.22
      wheel           0.30.0
      

      Code to reproduce:

      # -*- coding: utf-8 -*-
      import libcloud.security
      from libcloud.storage.types import Provider
      from libcloud.storage.providers import get_driver
      
      key = ''
      secret = ''
      
      cls = get_driver(Provider.AZURE_BLOBS)
      driver = cls(key=key, secret=secret)
      print "Containers: ", driver.list_containers()
      testing = driver.get_container(container_name='testing')
      print "Objects in 'testing': ", testing.list_objects()
      print "Downloading LICENSE.txt:"
      lic = testing.get_object('LICENSE.txt')
      testing.download_object(lic, 'C:\\Users\\dayd3\\Downloads\\LICENSE.txt')
      print "Uploading via driver:"
      driver.upload_object(file_path='C:\\Users\\dayd3\\Downloads\\test.txt', container=testing, object_name='test/test.txt')
      print "Uploading via container:"
      testing.upload_object(file_path='C:\\Users\\dayd3\\Downloads\\test.txt', object_name='test/test.txt')}}
      

      Error:

      > python azure.py
      Containers:  [<Container: name=testing, provider=Microsoft Azure (blobs)>]
      Objects in 'testing':  []
      Uploading via driver:
      Traceback (most recent call last):
        File "azure.py", line 15, in <module>
          driver.upload_object(file_path='C:\\Users\\dayd3\\Downloads\\test.txt', container=testing, object_name='test/test.txt')
        File "C:\Users\dayd3\Envs\libcloud\lib\site-packages\libcloud\storage\drivers\azure_blobs.py", line 771, in upload_object
          use_lease=ex_use_lease)
        File "C:\Users\dayd3\Envs\libcloud\lib\site-packages\libcloud\storage\drivers\azure_blobs.py", line 895, in _put_object
          stream=stream)
        File "C:\Users\dayd3\Envs\libcloud\lib\site-packages\libcloud\storage\base.py", line 627, in _upload_object
          headers=headers, raw=True)
        File "C:\Users\dayd3\Envs\libcloud\lib\site-packages\libcloud\common\base.py", line 590, in request
          stream=stream)
        File "C:\Users\dayd3\Envs\libcloud\lib\site-packages\libcloud\http.py", line 230, in prepared_request
          verify=self.ca_cert if self.ca_cert is not None else self.verify)
        File "C:\Users\dayd3\Envs\libcloud\lib\site-packages\requests\sessions.py", line 618, in send
          r = adapter.send(request, **kwargs)
        File "C:\Users\dayd3\Envs\libcloud\lib\site-packages\requests\adapters.py", line 508, in send
          raise ConnectionError(e, request=request)
      requests.exceptions.ConnectionError: HTTPSConnectionPool(host='dmainnovbdl1.blob.core.windows.net', port=443): Max retries exceeded with url: /testing/test/test.txt (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x0000000003B6A6D8>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))
      

      I'm receiving the same problem with download_object. I've updated the code sample above, and here's the output:

      Containers:  [<Container: name=testing, provider=Microsoft Azure (blobs)>]                                                            
      Objects in 'testing':  [<Object: name=LICENSE.txt, size=6019, hash=0x8D526E7516C1176, provider=Microsoft Azure (blobs) ...>]          
      Downloading LICENSE.txt:                                                                                                              
      Traceback (most recent call last):                                                                                                    
        File "azure.py", line 16, in <module>                                                                                               
          testing.download_object(lic, 'C:\\Users\\dayd3\\Downloads\\LICENSE.txt')                                                          
        File "C:\Users\dayd3\Envs\libcloud\lib\site-packages\libcloud\storage\base.py", line 162, in download_object                        
          delete_on_failure=delete_on_failure)                                                                                              
        File "C:\Users\dayd3\Envs\libcloud\lib\site-packages\libcloud\storage\drivers\azure_blobs.py", line 546, in download_object         
          response = self.connection.request(obj_path, raw=True, data=None)                                                                 
        File "C:\Users\dayd3\Envs\libcloud\lib\site-packages\libcloud\common\base.py", line 590, in request                                 
          stream=stream)                                                                                                                    
        File "C:\Users\dayd3\Envs\libcloud\lib\site-packages\libcloud\http.py", line 230, in prepared_request                               
          verify=self.ca_cert if self.ca_cert is not None else self.verify)                                                                 
        File "C:\Users\dayd3\Envs\libcloud\lib\site-packages\requests\sessions.py", line 618, in send                                       
          r = adapter.send(request, **kwargs)                                                                                               
        File "C:\Users\dayd3\Envs\libcloud\lib\site-packages\requests\adapters.py", line 508, in send                                       
          raise ConnectionError(e, request=request)                                                                                         
      requests.exceptions.ConnectionError: HTTPSConnectionPool(host='dmainnovbdl1.blob.core.windows.net', port=443): Max retries exceeded wi
      th url: /testing/LICENSE.txt (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x0000000003DE57F0>:
       Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))                                                           
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dday376@yahoo.com David L. Day
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: