az storage container exists fails when trying to check for a container from a storage account that doesn't exist
This is autogenerated. Please review and update as needed.
Describe the bug
Command Name
az storage container exists
Errors:
The command failed with an unexpected error. Here is the traceback:
'MaxRetryError' object has no attribute 'lower'
Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.6/site-packages/urllib3/connection.py", line 175, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/usr/lib64/az/lib/python3.6/site-packages/urllib3/util/connection.py", line 73, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/lib64/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.6/site-packages/urllib3/connectionpool.py", line 706, in urlopen
chunked=chunked,
File "/usr/lib64/az/lib/python3.6/site-packages/urllib3/connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "/usr/lib64/az/lib/python3.6/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
conn.connect()
File "/usr/lib64/az/lib/python3.6/site-packages/urllib3/connection.py", line 358, in connect
conn = self._new_conn()
File "/usr/lib64/az/lib/python3.6/site-packages/urllib3/connection.py", line 187, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7fffe6e309b0>: Failed to establish a new connection: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/lib64/az/lib/python3.6/site-packages/urllib3/connectionpool.py", line 756, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/usr/lib64/az/lib/python3.6/site-packages/urllib3/util/retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='stuse2ciok8sdtf2.blob.core.windows.net', port=443): Max retries exceeded with url: /sbx-az3-velero?restype=container (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fffe6e309b0>: Failed to establish a new connection: [Errno -2] Name or service not known',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/common/storageclient.py", line 321, in _perform_request
response = self._httpclient.perform_request(request)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/common/_http/httpclient.py", line 92, in perform_request
proxies=self.proxies)
File "/usr/lib64/az/lib/python3.6/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib64/az/lib/python3.6/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/usr/lib64/az/lib/python3.6/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='stuse2ciok8sdtf2.blob.core.windows.net', port=443): Max retries exceeded with url: /sbx-az3-velero?restype=container (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fffe6e309b0>: Failed to establish a new connection: [Errno -2] Name or service not known',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 692, in _run_job
result = cmd_copy(params)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
return self.handler(*args, **kwargs)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/blob/baseblobservice.py", line 1740, in exists
self._perform_request(request, expected_errors=expected_errors)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/common/storageclient.py", line 430, in _perform_request
raise ex
File "/usr/lib64/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/common/storageclient.py", line 361, in _perform_request
raise _wrap_exception(ex, AzureException)
azure.common.AzureException: HTTPSConnectionPool(host='stuse2ciok8sdtf2.blob.core.windows.net', port=443): Max retries exceeded with url: /sbx-az3-velero?restype=container (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fffe6e309b0>: Failed to establish a new connection: [Errno -2] Name or service not known',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 658, in execute
raise ex
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 721, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 713, in _run_job
return cmd_copy.exception_handler(ex)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/__init__.py", line 377, in new_handler
handler(ex)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/__init__.py", line 282, in handler
if isinstance(ex, AzureException) and 'incorrect padding' in ex.args[0].lower():
AttributeError: 'MaxRetryError' object has no attribute 'lower'
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- Put any pre-requisite steps here...
-
az storage container exists -n {} --account-name {} --only-show-errors
Expected Behavior
Environment Summary
Linux-3.10.0-1160.45.1.el7.x86_64-x86_64-with-oracle-7.9, Oracle Linux Server 7.9
Python 3.6.8
Installer: RPM
azure-cli 2.34.1
Additional Context
storage
Seems like we failed to establish a http connection. Can you confirm if storage account stuse2ciok8sdtf2 really exists?
Can you explicitly specify a credential? Either --account-key or --sas-token or --connection-string could work to help identify if it's credential issue.
The error occurs only if the storage account doesn't exist. In this case, stuse2ciok8stf2 didn't exist. However, I was expecting a good response (container exists as false) instead of an exception here.
I'm getting something different but still a bug. In my case the storage account exists but the blob container doesn't. I'm getting:
RequestId:0416fa59-501e-0085-4ad0-ad852a000000
Time:2022-08-11T22:20:48.8167530Z
ErrorCode:InvalidUri
I'm getting something different but still a bug. In my case the storage account exists but the blob container doesn't. I'm getting:
RequestId:0416fa59-501e-0085-4ad0-ad852a000000 Time:2022-08-11T22:20:48.8167530Z ErrorCode:InvalidUri
Seems that service response has changed so that Python SDK azure-storage-blob can't identify the error
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.
Issue Details
This is autogenerated. Please review and update as needed.
Describe the bug
Command Name
az storage container exists
Errors:
The command failed with an unexpected error. Here is the traceback:
'MaxRetryError' object has no attribute 'lower'
Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.6/site-packages/urllib3/connection.py", line 175, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/usr/lib64/az/lib/python3.6/site-packages/urllib3/util/connection.py", line 73, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/lib64/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.6/site-packages/urllib3/connectionpool.py", line 706, in urlopen
chunked=chunked,
File "/usr/lib64/az/lib/python3.6/site-packages/urllib3/connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "/usr/lib64/az/lib/python3.6/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
conn.connect()
File "/usr/lib64/az/lib/python3.6/site-packages/urllib3/connection.py", line 358, in connect
conn = self._new_conn()
File "/usr/lib64/az/lib/python3.6/site-packages/urllib3/connection.py", line 187, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7fffe6e309b0>: Failed to establish a new connection: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/lib64/az/lib/python3.6/site-packages/urllib3/connectionpool.py", line 756, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/usr/lib64/az/lib/python3.6/site-packages/urllib3/util/retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='stuse2ciok8sdtf2.blob.core.windows.net', port=443): Max retries exceeded with url: /sbx-az3-velero?restype=container (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fffe6e309b0>: Failed to establish a new connection: [Errno -2] Name or service not known',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/common/storageclient.py", line 321, in _perform_request
response = self._httpclient.perform_request(request)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/common/_http/httpclient.py", line 92, in perform_request
proxies=self.proxies)
File "/usr/lib64/az/lib/python3.6/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib64/az/lib/python3.6/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/usr/lib64/az/lib/python3.6/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='stuse2ciok8sdtf2.blob.core.windows.net', port=443): Max retries exceeded with url: /sbx-az3-velero?restype=container (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fffe6e309b0>: Failed to establish a new connection: [Errno -2] Name or service not known',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 692, in _run_job
result = cmd_copy(params)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
return self.handler(*args, **kwargs)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/blob/baseblobservice.py", line 1740, in exists
self._perform_request(request, expected_errors=expected_errors)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/common/storageclient.py", line 430, in _perform_request
raise ex
File "/usr/lib64/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/common/storageclient.py", line 361, in _perform_request
raise _wrap_exception(ex, AzureException)
azure.common.AzureException: HTTPSConnectionPool(host='stuse2ciok8sdtf2.blob.core.windows.net', port=443): Max retries exceeded with url: /sbx-az3-velero?restype=container (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fffe6e309b0>: Failed to establish a new connection: [Errno -2] Name or service not known',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 658, in execute
raise ex
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 721, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 713, in _run_job
return cmd_copy.exception_handler(ex)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/__init__.py", line 377, in new_handler
handler(ex)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/__init__.py", line 282, in handler
if isinstance(ex, AzureException) and 'incorrect padding' in ex.args[0].lower():
AttributeError: 'MaxRetryError' object has no attribute 'lower'
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- Put any pre-requisite steps here...
-
az storage container exists -n {} --account-name {} --only-show-errors
Expected Behavior
Environment Summary
Linux-3.10.0-1160.45.1.el7.x86_64-x86_64-with-oracle-7.9, Oracle Linux Server 7.9
Python 3.6.8
Installer: RPM
azure-cli 2.34.1
Additional Context
| Author: | srikiz |
|---|---|
| Assignees: | evelyn-ys |
| Labels: |
|
| Milestone: | Backlog |
The error occurs only if the storage account doesn't exist. In this case, stuse2ciok8stf2 didn't exist. However, I was expecting a good response instead (but the container exists as false).
On Tue, Apr 26, 2022 at 3:14 PM Yishi Wang @.***> wrote:
Seems like we failed to establish a http connection. Can you confirm if storage account stuse2ciok8sdtf2 really exists?
— Reply to this email directly, view it on GitHub https://github.com/Azure/azure-cli/issues/22189#issuecomment-1109584108, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACDJI3U6S44V3CBRMBY46BTVG63H7ANCNFSM5ULF2AUA . You are receiving this because you authored the thread.Message ID: @.***>