Azure:AZ CLI ConnectedVMware VM guest-Enable ...返回:“ errorl”对象不可call

发布于 2025-02-11 18:30:35 字数 2206 浏览 1 评论 0原文

使用Azure门户时,我可以选择一个已在Azure中“启用”的VM作为资源,然后对其执行“启用访客管理”操作。 但是,当尝试使用AZ CLI执行相同的更改时,我会收到错误,如下所示...

命令的命令格式.....

az connectedvmware vm guest-agent enable --username "vm user name" --password "vm password" --resource-group "resource group name" --subscription "Name or ID of subscription" --vm-name "vm name"

返回错误……

az   ERROR: The command failed with an unexpected error. Here is the traceback:t 
C:\Users\Administrator\Desktop\CLI create VM.ps1:9 char:1
az connectedvmware vm guest-agent enable --username "administrator" 
CategoryInfo          : NotSpecified: (ERROR: The comm... the traceback::String) [], 
RemoteException

FullyQualifiedErrorId : NativeCommandError

 

ERROR: 'str' object is not callable

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 663, in execute

  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-
packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially

  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-
packages\azure/cli/core/commands/__init__.py", line 697, in _run_job

  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, 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 "C:\Users\Administrator\.azure\cliextensions\connectedvmware\azext_connectedvmware\custom.py", line 1790, in enable_guest_agent
enable_system_identity(vm_client, resource_group_name, vm_name)

File "C:\Users\Administrator\.azure\cliextensions\connectedvmware\azext_connectedvmware\custom.py", line 1770, in enable_system_identity
return sdk_no_wait(
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/util.py", line 693, in sdk_no_wait

TypeError: 'str' object is not callable

我成功地执行了其他各种ConnectedVMware CLI CLI命令使用上面命令提到的各种输入,但是“访客代理”变体似乎始终如一地失败。 任何在工作中的帮助都将不胜感激,

When using the azure portal, I can select a VM that is already 'Enabled' in Azure as a resource then perform the 'Enable Guest Management' action on it.
But when attempting to use the Az cli to perform the same change, I get error as shown below...

Format of command used.....

az connectedvmware vm guest-agent enable --username "vm user name" --password "vm password" --resource-group "resource group name" --subscription "Name or ID of subscription" --vm-name "vm name"

Error returned......

az   ERROR: The command failed with an unexpected error. Here is the traceback:t 
C:\Users\Administrator\Desktop\CLI create VM.ps1:9 char:1
az connectedvmware vm guest-agent enable --username "administrator" 
CategoryInfo          : NotSpecified: (ERROR: The comm... the traceback::String) [], 
RemoteException

FullyQualifiedErrorId : NativeCommandError

 

ERROR: 'str' object is not callable

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 663, in execute

  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-
packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially

  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-
packages\azure/cli/core/commands/__init__.py", line 697, in _run_job

  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, 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 "C:\Users\Administrator\.azure\cliextensions\connectedvmware\azext_connectedvmware\custom.py", line 1790, in enable_guest_agent
enable_system_identity(vm_client, resource_group_name, vm_name)

File "C:\Users\Administrator\.azure\cliextensions\connectedvmware\azext_connectedvmware\custom.py", line 1770, in enable_system_identity
return sdk_no_wait(
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/util.py", line 693, in sdk_no_wait

TypeError: 'str' object is not callable

I am successfully executing other various connectedVMware cli commands that use the various inputs mentioned for the command above but the "guest-agent enable" variant seems to fail consistently.
Any help on working round would be appreciated,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦里兽 2025-02-18 18:30:35

您的命令格式绝对可以。

az connectedvmware vm guest-agent enable --username "vm user name" --password "vm password" --resource-group "resource group name" --subscription "Name or ID of subscription" --vm-name "vm name"

有几个原因来获取此错误,下面就是其中之一。

示例:保留关键字
如果我们在我们的情况下提到了变量名作为保留关键字,则是str

示例代码:

str = "Hello"
stringX = "Raj"

print(str(str) + stringX)

输出错误:

TypeError: 'str' object is not callable

上述示例的分辨率:

stringY = "Hello"
stringX = "Raj"

print(str(stringY) + stringX)

输出结果:

Hello Raj
  • 遵循适当的命名约定。
  • 如果您使用的是任何运算符,请确保重新检查,该操作员在字符串上执行格式化。
  • 不要将保留的关键字用于任何变量。

感谢 python pool typeerror:'str'对象不是可呼叫

Your format of command is absolutely fine.

az connectedvmware vm guest-agent enable --username "vm user name" --password "vm password" --resource-group "resource group name" --subscription "Name or ID of subscription" --vm-name "vm name"

There are several reasons to get this error, below is one of them.

Example: Reserved Keyword
If we are mentioned the variable name as a reserved keyword in our case, it is str.

Sample Code:

str = "Hello"
stringX = "Raj"

print(str(str) + stringX)

Output with Error:

TypeError: 'str' object is not callable

Resolution for the above Example:

stringY = "Hello"
stringX = "Raj"

print(str(stringY) + stringX)

Output with Result:

Hello Raj
  • Follow the proper naming convention.
  • Make sure to recheck if you are using any % operator which performs the formatting on string.
  • Don't use the reserved Keyword for any of the variables.

Thanks to Python Pool for the detailed information on TypeError: 'str' object is not callable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文