Azure-cli: 'az acr login' fails in 2.0.24

Created on 8 Jan 2018  路  10Comments  路  Source: Azure/azure-cli

Problem:
Operations involving type login_server fail due to AttributeError: 'bool' object has no attribute 'rstrip'

Not limited to az acr login -- see example below for az acr repository list.

Confirmed on Windows, Linux, and in the Docker container.

Examples (Windows):

C:\Users\marsma>az acr login --name acr604
'bool' object has no attribute 'rstrip'
Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\knack\cli.py", line 193, in invoke
    cmd_result = self.invocation.execute(args)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\core\commands\__init__.py", line 319, in execute
    six.reraise(*sys.exc_info())
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\six.py", line 693, in reraise
    raise value
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\core\commands\__init__.py", line 292, in execute
    result = cmd(params)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\core\commands\__init__.py", line 169, in __call__
    return super(AzCliCommand, self).__call__(*args, **kwargs)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\knack\commands.py", line 109, in __call__
    return self.handler(*args, **kwargs)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\core\__init__.py", line 328, in default_command_handler
    result = op(**command_args)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\command_modules\acr\custom.py", line 195, in acr_login
    password=password)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\command_modules\acr\_docker_utils.py", line 194, in get_login_credentials
    only_refresh_token=True)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\command_modules\acr\_docker_utils.py", line 150, in _get_credentials
    password = _get_aad_token(login_server, only_refresh_token, repository, permission)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\command_modules\acr\_docker_utils.py", line 35, in _get_aad_token
    login_server = login_server.rstrip('/')
AttributeError: 'bool' object has no attribute 'rstrip'
C:\Users\marsma>az acr repository list --name acr604
'bool' object has no attribute 'rstrip'
Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\knack\cli.py", line 193, in invoke
    cmd_result = self.invocation.execute(args)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\core\commands\__init__.py", line 319, in execute
    six.reraise(*sys.exc_info())
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\six.py", line 693, in reraise
    raise value
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\core\commands\__init__.py", line 292, in execute
    result = cmd(params)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\core\commands\__init__.py", line 169, in __call__
    return super(AzCliCommand, self).__call__(*args, **kwargs)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\knack\commands.py", line 109, in __call__
    return self.handler(*args, **kwargs)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\core\__init__.py", line 328, in default_command_handler
    result = op(**command_args)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\command_modules\acr\repository.py", line 166, in acr_repository_list
    password=password)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\command_modules\acr\_docker_utils.py", line 219, in get_access_credentials
    permission=permission)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\command_modules\acr\_docker_utils.py", line 150, in _get_credentials
    password = _get_aad_token(login_server, only_refresh_token, repository, permission)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\command_modules\acr\_docker_utils.py", line 35, in _get_aad_token
    login_server = login_server.rstrip('/')
AttributeError: 'bool' object has no attribute 'rstrip'

Environment summary

OS / Install Method / shell type:
Windows 10 / *.msi / cmd.exe
Ubuntu 16.04 / apt / bash
Docker / docker run / bash

Output of az version from Docker container:

bash-4.3# az --version
azure-cli (2.0.24)

acr (2.0.18)
acs (2.0.23)
advisor (0.1.1)
appservice (0.1.23)
backup (1.0.4)
batch (3.1.8)
batchai (0.1.4)
billing (0.1.7)
cdn (0.0.11)
cloud (2.0.11)
cognitiveservices (0.1.10)
command-modules-nspkg (2.0.1)
configure (2.0.13)
consumption (0.2.1)
container (0.1.16)
core (2.0.24)
cosmosdb (0.1.16)
dla (0.0.16)
dls (0.0.19)
eventgrid (0.1.7)
extension (0.0.7)
feedback (2.0.7)
find (0.2.8)
interactive (0.3.12)
iot (0.1.16)
keyvault (2.0.16)
lab (0.0.14)
monitor (0.0.14)
network (2.0.20)
nspkg (3.0.1)
profile (2.0.17)
rdbms (0.0.10)
redis (0.2.11)
reservations (0.1.1)
resource (2.0.20)
role (2.0.16)
servicefabric (0.0.8)
sql (2.0.18)
storage (2.0.22)
vm (2.0.23)

Python location '/usr/local/bin/python'
Extensions directory '/root/.azure/cliextensions'

Python (Linux) 3.6.3 (default, Dec 20 2017, 01:32:21)
[GCC 5.3.0]

Legal docs and information: aka.ms/AzureCliLegal
Container Registry Service Attention bug

Most helpful comment

Also saw the break, thanks for the fix. Should really get more test since it's weakly typed.
For people using ubuntu repository, can install the old version as a temp fix:

sudo apt install azure-cli=2.0.23-1

All 10 comments

Thanks for the report @mmacy!

Also saw the break, thanks for the fix. Should really get more test since it's weakly typed.
For people using ubuntu repository, can install the old version as a temp fix:

sudo apt install azure-cli=2.0.23-1

az acr repository list still fails on mac os

@terjetyl What is your CLI version? 2.0.24 (or acr (2.0.18)) is having this issue as a regression. Can you try updating to the more recent release?

2.0.25 will be released tomorrow. Until then you'd have to try an edge build or dev setup.

I am hitting this issue on mac osx but can't seem to get acr component to a version > 2.0.22. I tried '''brew update && brew upgrade azure-cli but am only getting 2.0.22 version. How can I force update to 2.0.25?

@rguthriemsft Within the current version of the the Azure CLI (which is 2.0.30 at the time of this comment), the ACR command group version is 2.0.22:

$ az --version
azure-cli (2.0.30)

acr (2.0.22)
acs (2.0.30)
advisor (0.5.0)

What is your azure-cli version?

@mmacy I have same as far as version
az --version
azure-cli (2.0.30)
acr (2.0.22)

My challenge is I am still getting the error described in the bug when I do az acr login

Error saving credentials: error storing credentials - err: exit status 1, out: The user name or passphrase you entered is not correct.

@rguthriemsft That actually sounds like a different issue. The bug described in this GitHub issue surfaced during the conversion of the CLI to Knack. The issue in this particular bug (AttributeError: 'bool' object has no attribute 'rstrip') has since been resolved.

More details are needed to help diagnose your issue. Things like:

  1. What OS and shell are you using?
  2. Does it happen with every registry that you create?
  3. Is this registry in your own subscription?
  4. Any other details related to your environment, both local and in Azure.

(Note that az acr login is not supported in the Azure Cloud Shell as the Cloud Shell doesn't include the Docker daemon, which az acr login invokes in the background.)

@mmacy I will open a new issue for this and copy in the conversation.

Was this page helpful?
0 / 5 - 0 ratings