Azure-cli: az acr login error: AttributeError: 'bool' object has no attribute 'rstrip'

Created on 15 Jan 2018  路  4Comments  路  Source: Azure/azure-cli

command executed to reproduce this bug

Commands to set up the appropriate resources

RESOURCE_GROUP="batchAItest"              
LOCATION='westus'
CONTAINER_REGISTRY='batchAIcontainers'
SKU='Basic'

az group create --name ${RESOURCE_GROUP} --location $LOCATION
az acr create --resource-group ${RESOURCE_GROUP} --name ${CONTAINER_REGISTRY} --sku $SKU

Wait til the resource is set up

$ az acr list
NAME               RESOURCE GROUP    LOCATION    SKU    LOGIN SERVER                  CREATION DATE                     ADMIN ENABLED    STATUS
-----------------  ----------------  ----------  -----  ----------------------------  --------------------------------  ---------------  --------
batchAIcontainers  batchAItest       westus      Basic  batchaicontainers.azurecr.io  2018-01-15T18:09:00.560226+00:00  False            None

try logging into the container registry

$ az acr login --name $CONTAINER_REGISTRY
'bool' object has no attribute 'rstrip'
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.0.24/libexec/lib/python3.6/site-packages/knack/cli.py", line 193, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/Cellar/azure-cli/2.0.24/libexec/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 319, in execute
    six.reraise(*sys.exc_info())
  File "/usr/local/Cellar/azure-cli/2.0.24/libexec/lib/python3.6/site-packages/six.py", line 693, in reraise
    raise value
  File "/usr/local/Cellar/azure-cli/2.0.24/libexec/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 292, in execute
    result = cmd(params)
  File "/usr/local/Cellar/azure-cli/2.0.24/libexec/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 169, in __call__
    return super(AzCliCommand, self).__call__(*args, **kwargs)
  File "/usr/local/Cellar/azure-cli/2.0.24/libexec/lib/python3.6/site-packages/knack/commands.py", line 109, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/Cellar/azure-cli/2.0.24/libexec/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 328, in default_command_handler
    result = op(**command_args)
  File "/usr/local/Cellar/azure-cli/2.0.24/libexec/lib/python3.6/site-packages/azure/cli/command_modules/acr/custom.py", line 195, in acr_login
    password=password)
  File "/usr/local/Cellar/azure-cli/2.0.24/libexec/lib/python3.6/site-packages/azure/cli/command_modules/acr/_docker_utils.py", line 194, in get_login_credentials
    only_refresh_token=True)
  File "/usr/local/Cellar/azure-cli/2.0.24/libexec/lib/python3.6/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 "/usr/local/Cellar/azure-cli/2.0.24/libexec/lib/python3.6/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'

Stack Overflow has a post about the exact same issue at link. The proposed solution from Stack Overflow of modifying line 150 of /usr/local/Cellar/azure-cli/2.0.24/libexec/lib/python3.6/site-packages/azure/cli/command_modules/acr/_docker_utils.py did not work for me.


Environment summary

Install Method:
MacOS High Sierra version 10.13.2, azure-cli installed via Homebrew[1.4.3 Homebrew/homebrew-core (git revision 3c79; last commit 2018-01-12)] in a bash shell

$ az --version

azure-cli (2.0.24)

acr (2.0.18)
...
Python location '/usr/local/opt/python3/bin/python3.6'
Extensions directory '/Users/karenng/.azure/cliextensions'

Python (Darwin) 3.6.4 (default, Jan  6 2018, 11:51:59)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]

Container Registry Service Attention

Most helpful comment

v2.0.25 will be released on Wednesday.

All 4 comments

related: I was following this official tutorial for setting up ACR: https://docs.microsoft.com/en-us/azure/container-service/kubernetes/container-service-tutorial-kubernetes-prepare-acr

Please update the tutorial page if more steps are needed to get the tutorial working

Hi @karenyyng, this is a known issue (#5229) in Azure CLI v2.0.24, and the fix (#5257) has been committed.

Please use Azure CLI v2.0.23 until the new CLI version with the fix is published.

v2.0.25 will be released on Wednesday.

Thanks for the clarification here and replying to my comment at the tutorial.

Was this page helpful?
0 / 5 - 0 ratings