gpt4 book ai didi

azure - 属性错误: 'ContainerGroupsOperations' object has no attribute 'delete'

转载 作者:行者123 更新时间:2023-12-04 14:50:14 24 4
gpt4 key购买 nike

我在旧 cli 版本上成功运行以下“az 容器删除”。但是,当我升级到2.28.0时,它失败并出现错误

az 容器删除 --subscription xx --resource-group xx --name xx

Errors:
The command failed with an unexpected error. Here is the traceback:
'ContainerGroupsOperations' object has no attribute 'delete'
Traceback (most recent call last):
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 657, in execute
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 691, in _run_job
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 328, in __call__
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/container/custom.py", line 66, in delete_container
AttributeError: 'ContainerGroupsOperations' object has no attribute 'delete

最佳答案

这是 Microsoft 将 Az CLI 更新到版本 2.28.0 时引入的已知问题。

目前除了降级之外没有其他解决方案,但 MS 已得到确认。您可以在官方存储库中跟踪他们的回复: https://github.com/Azure/azure-cli/issues/19475

不过,还是有一些解决方法。

使用 REST API:

RESOURCE_GROUP=my-rg
ACI_CONTAINER_NAME=containername
SUBSCRIPTION_ID="xxxxxxxxxxxxxxxxxxxxxxxx"
az rest --method delete \
--uri "/subscriptions/{subscriptionId}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.ContainerInstance/containerGroups/${ACI_CONTAINER_NAME}?api-version=2019-12-01" \
--subscription ${SUBSCRIPTION_ID}

使用 PowerShell:

Remove-AzContainerGroup -Name ${var.resourceName} -ResourceGroupName ${var.resourceGroup} -Confirm:$False

关于azure - 属性错误: 'ContainerGroupsOperations' object has no attribute 'delete' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69200795/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com