Skip to content

AZ Cli incorrectly returns exit code 0 even on failure #11355

@noetro

Description

@noetro

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name
az acr login

Errors:
The command az acr login silently fails on a network error and the process returns exit code 0. This makes breaks Unix convention and makes it more difficult in automation to detect failure.

To Reproduce:

We are seeing the error intermittently based on network failures. The network failures are not the issue here, the exit code of 0 is. Whenever we do see a network failure, the exit code is consistently 0. Here is the relevant section of output from running the command with the --debug flag.

DEBUG: urllib3.connectionpool : Starting new HTTPS connection (1): REDACTED.azurecr.io:443 DEBUG: urllib3.connectionpool : https://REDACTED.azurecr.io:443 "POST /oauth2/exchange HTTP/1.1" 200 None Error response from daemon: Get https://REDACTED.azurecr.io/v2/: dial tcp: lookup REDACTED.azurecr.io on [::1]:53: read udp [::1]:55595->[::1]:53: read: connection refused DEBUG: Event: CommandInvoker.OnTransformResult [<function _resource_group_transform at 0x7f87591552a8>, <function _x509_from_base64_to_hex_transform at 0x7f8759155320>] DEBUG: Event: CommandInvoker.OnFilterResult [] DEBUG: Event: Cli.PostExecute [] INFO: az_command_data_logger : exit code: 0

Expected Behavior

On any failure to successfully complete the login, I would expect the process to return an exit code other than 0 to indicate failure.

Environment Summary

Linux-3.10.0-1062.4.3.el7.x86_64-x86_64-with-centos-7.7.1908-Core
Python 2.7.5
Shell: bash

azure-cli 2.0.76

Additional Context

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions