[ 
https://issues.apache.org/jira/browse/LIBCLOUD-959?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

David L. Day updated LIBCLOUD-959:
----------------------------------
    Description: 
The upload_object method on both the driver and container objects fails for 
Provider.AZURE_BLOBS. Listing containers and objects works.

{noformat}
> 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
{noformat}

Code to reproduce:
{code:python}
# -*- 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 "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')}}
{code}

Error:
{noformat}
> 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',))
{noformat}

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

{noformat}
> 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
{noformat}

Code to reproduce:
{code:python}
# -*- 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 "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')}}
{code}

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',))}}



> AZURE_BLOBS upload_object fails on both Container and Driver
> ------------------------------------------------------------
>
>                 Key: LIBCLOUD-959
>                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-959
>             Project: Libcloud
>          Issue Type: Bug
>          Components: Storage
>         Environment: Python 2.7.11
>            Reporter: David L. Day
>
> The upload_object method on both the driver and container objects fails for 
> Provider.AZURE_BLOBS. Listing containers and objects works.
> {noformat}
> > 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
> {noformat}
> Code to reproduce:
> {code:python}
> # -*- 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 "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')}}
> {code}
> Error:
> {noformat}
> > 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',))
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to