Azure / Azure/azure-cli

az storage container exists fails when trying to check for a container from a storage account that doesn't exist

Open
#22,189 7 comments 0 reactions 1 assignee Claimed by @evelyn-ys View on GitHub
act-codegen-extensibility-squad Auto-Assign customer-reported Service Attention Storage
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### **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: : 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(': 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(': 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(': 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.