1

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,

1 Answers1

0

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.

RajkumarPalnati
  • 541
  • 2
  • 6