azure-cli: "az container logs" does not work in 2.28.0
Describe the bug
Command Name
az container logs
does not work in 2.28.0. I works fine in 2.27.2
Errors:
The command failed with an unexpected error. Here is the traceback:
'ContainerInstanceManagementClient' object has no attribute 'container'
Traceback (most recent call last):
File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
raise ex
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/command_operation.py", line 112, in handler
client = self.client_factory(self.cli_ctx, command_args) if self.client_factory else None
File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/container/_client_factory.py", line 18, in cf_container
return _container_instance_client_factory(cli_ctx).container
AttributeError: 'ContainerInstanceManagementClient' object has no attribute 'container'
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 container logs -g xxxx -n xxxx
Expected Behavior
Logs from the container should be shown.
Environment Summary
Linux-5.13.12-x86_64-with-debian-11.0, Debian GNU/Linux 11 (bullseye)
Python 3.6.10
Installer: DEB
azure-cli 2.28.0
Extensions:
portal 0.1.1
log-analytics 0.2.2
import-export 0.1.1
Additional Context
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 25
- Comments: 32 (1 by maintainers)
Commits related to this issue
- https://github.com/Azure/azure-cli/issues/19475 — committed to geekzter/azure-minecraft-docker by geekzter 3 years ago
- Workflow strategy update (#24) * Terraform 1.0.8 * Include azure cli version in workflow strategy * Enable input on manual workflow invocation * Work around Azure CLI bug https://github.com/... — committed to geekzter/azure-minecraft-docker by geekzter 3 years ago
- Workflow fix (#25) * Forward compatibility test for Azure CLI * Use 'az container' only wih Azure CLI 2.29 and up (workaround for https://github.com/Azure/azure-cli/issues/19475) * Show connect... — committed to geekzter/azure-minecraft-docker by geekzter 3 years ago
I am also having this problem with the
az container exec ...
command. I get a similar error message:(azure-cli installed via chocolatey)
Verified that 2.29.0 works fine as before.
Why is the latest installer linked to this broken version? MS, please downgrade on your website. I was trying the CLI for the first time yesterday and assumed I was doing something wrong. I finally found this thread and downgraded and everything is fine. I lost half a day because while you have known about this bug for a month you still direct people to the broken version. Literally the first thing I wanted to do with my first container was of course “az container exec”. This issue is keeping people from adopting your tools.
+1 Indeed @guywood13 , I had the same issue yesterday. I have created a task to downgrade az cli to the previous version
+1 Plus MS have upgraded their MS hosted agents in Azure DevOps on 13th to this version so downgrading isn’t easy.
I’m running az with docker for now:
Hope this helps someone!
if your use-case is DELETE, here is a workaround that avoids downgrading the CLI, and uses it to take care of the auth
there is a gigantic blocker if you are using AzureCli Task on Azure DevOps. There is no way to specify to this task the version to be use, so latest is always used .
You might need a different version, for me 2.27.2-1~focal worked. See the link below for other versions.
https://pkgs.org/download/azure-cli
As @NakagawaMakoto mention, after I downgrade to 2.27.2 exec command works nicely. Here is link for installer https://azurecliprod.blob.core.windows.net/msi/azure-cli-2.27.2.msi