Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3.01k forks source link

--disk-type seems to be wrongly evaluated on AzCLI version 2.65 #30414

Open shmohanty opened 5 days ago

shmohanty commented 5 days ago

Describe the bug

With the version of AZCLI 2.65 the below command (which works on AZCLI 2.64) : az lab vm create --only-show-errors --resource-group 'WEU-GEN-Dev-16' --lab-name 'WEU-GEN-Dev-16' --name 'MJHTest1' --admin-username 'pwAtpUser' --admin-password 'MJHTest1' --image-type gallery --image 'Windows 11 Pro, version 23H2' --size 'Standard_B4ms' --disk-type 'Standard' --vnet-name 'WEU-GEN-Dev-16' --subnet 'WEU-General' --ip-configuration 'private'

that parameter --disk-type seems to be wrongly evaluated , Seems it accepts 3 kinds of values but if we enter it it says it accepts only boolean .

Below are the logs in our Lab we created , from a report from my internal repro : The command failed with an unexpected error. Here is the traceback: Expect <class 'bool'>, got Standard (<class 'str'>) Traceback (most recent call last): File "/usr/lib64/az/lib/python3.9/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 666, in execute raise ex File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 733, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 703, in _run_job result = cmd_copy(params) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_command.py", line 155, in call return self._handler(*args, *kwargs) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/lab/aaz/latest/lab/_create_environment.py", line 49, in _handler super()._handler(command_args) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_command.py", line 159, in _handler self.ctx = AAZCommandCtx( File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_command_ctx.py", line 30, in init cmd_arg.apply(self.args, dest) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_arg_action.py", line 58, in apply self._assign_data(args, data, dest, keys) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_arg_action.py", line 73, in _assign_data arg[key] = data File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_field_value.py", line 76, in setitem self._data[name] = attr_schema.process_data(data, key=name) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_field_type.py", line 48, in process_data raise AAZInvalidValueError('Expect {}, got {} ({})'.format(self.DataType, data, type(data))) azure.cli.core.aaz.exceptions.AAZInvalidValueError: Expect <class 'bool'>, got Standard (<class 'str'>)

Related command

az lab vm create --only-show-errors --resource-group 'WEU-GEN-Dev-16' --lab-name 'WEU-GEN-Dev-16' --name 'MJHTest1' --admin-username 'pwAtpUser' --admin-password 'MJHTest1' --image-type gallery --image 'Windows 11 Pro, version 23H2' --size 'Standard_B4ms' --disk-type 'Standard' --vnet-name 'WEU-GEN-Dev-16' --subnet 'WEU-General' --ip-configuration 'private'

Errors

The command failed with an unexpected error. Here is the traceback: Expect <class 'bool'>, got Standard (<class 'str'>) Traceback (most recent call last): File "/usr/lib64/az/lib/python3.9/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 666, in execute raise ex File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 733, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 703, in _run_job result = cmd_copy(params) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_command.py", line 155, in call return self._handler(*args, *kwargs) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/lab/aaz/latest/lab/_create_environment.py", line 49, in _handler super()._handler(command_args) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_command.py", line 159, in _handler self.ctx = AAZCommandCtx( File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_command_ctx.py", line 30, in init cmd_arg.apply(self.args, dest) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_arg_action.py", line 58, in apply self._assign_data(args, data, dest, keys) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_arg_action.py", line 73, in _assign_data arg[key] = data File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_field_value.py", line 76, in setitem self._data[name] = attr_schema.process_data(data, key=name) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_field_type.py", line 48, in process_data raise AAZInvalidValueError('Expect {}, got {} ({})'.format(self.DataType, data, type(data))) azure.cli.core.aaz.exceptions.AAZInvalidValueError: Expect <class 'bool'>, got Standard (<class 'str'>)

Issue script & Debug output

PS /home/xxxxxx> az lab vm create --resource-group 'WEU-GEN-Dev-16' --lab-name 'WEU-GEN-Dev-16' --name 'MJHTest1' --admin-username 'pwAtpUser' --admin-password 'MJHTest1' --image-type gallery --image 'Windows 11 Pro, version 23H2' --size 'Standard_B4ms' --disk-type 'Standard' --vnet-name 'WEU-GEN-Dev-16' --subnet 'WEU-General' --ip-configuration 'private'--debug

cli.knack.cli: Command arguments: ['lab', 'vm', 'create', '--resource-group', 'WEU-GEN-Dev-16', '--lab-name', 'WEU-GEN-Dev-16', '--name', 'MJHTest1', '--admin-username', 'pwAtpUser', '--admin-password', 'MJHTest1', '--image-type', 'gallery', '--image', 'Windows 11 Pro, version 23H2', '--size', 'Standard_B4ms', '--disk-type', 'Standard', '--vnet-name', 'WEU-GEN-Dev-16', '--subnet', 'WEU-General', '--ip-configuration', 'private', '--debug'] cli.knack.cli: init debug log: Enable color in terminal. cli.knack.cli: Event: Cli.PreExecute [] cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7f954e1c81f0>, <function OutputProducer.on_global_arguments at 0x7f954e088b80>, <function CLIQuery.on_global_arguments at 0x7f954e022160>] cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate [] cli.azure.cli.core: Modules found from index for 'lab': ['azure.cli.command_modules.lab'] cli.azure.cli.core: Loading command modules: cli.azure.cli.core: Name Load Time Groups Commands cli.azure.cli.core: lab 0.145 11 33 cli.azure.cli.core: Total (1) 0.145 11 33 cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_next'] cli.azure.cli.core: Loading extensions: cli.azure.cli.core: Name Load Time Groups Commands Directory cli.azure.cli.core: ai-examples 0.053 1 1 /usr/lib/python3.9/site-packages/azure-cli-extensions/ai-examples cli.azure.cli.core: Total (1) 0.053 1 1 cli.azure.cli.core: Loaded 12 groups, 34 commands. cli.azure.cli.core: Found a match in the command table. cli.azure.cli.core: Raw command : lab vm create cli.azure.cli.core: Command table: lab vm create cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f954d480790>] cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/reply_shubhangi/.azure/commands/2024-11-25.15-59-27.lab_vm_create.528.log'. az_command_data_logger: command args: lab vm create --resource-group {} --lab-name {} --name {} --admin-username {} --admin-password {} --image-type {} --image {} --size {} --disk-type {} --vnet-name {} --subnet {} --ip-configuration {} --debug cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x7f954d4ab4c0>] cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad [] cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x7f954d4504c0>, <function register_cache_arguments..add_cache_arguments at 0x7f954d46d3a0>, <function register_upcoming_breaking_change_info..update_breaking_change_info at 0x7f954d46d430>] cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded [] cli.knack.cli: Event: CommandInvoker.OnPreParseArgs [] cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f954e088c10>, <function CLIQuery.handle_query_parameter at 0x7f954e0221f0>, <function register_ids_argument..parse_ids_arguments at 0x7f954d46d310>] This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus cli.azure.cli.core.azclierror: Traceback (most recent call last): File "/usr/lib64/az/lib/python3.9/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 666, in execute raise ex File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 733, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 703, in _run_job result = cmd_copy(params) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_command.py", line 155, in call return self._handler(*args, *kwargs) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/lab/aaz/latest/lab/_create_environment.py", line 49, in _handler super()._handler(command_args) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_command.py", line 159, in _handler self.ctx = AAZCommandCtx( File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_command_ctx.py", line 30, in init cmd_arg.apply(self.args, dest) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_arg_action.py", line 58, in apply self._assign_data(args, data, dest, keys) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_arg_action.py", line 73, in _assign_data arg[key] = data File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_field_value.py", line 76, in setitem self._data[name] = attr_schema.process_data(data, key=name) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_field_type.py", line 48, in process_data raise AAZInvalidValueError('Expect {}, got {} ({})'.format(self.DataType, data, type(data))) azure.cli.core.aaz.exceptions.AAZInvalidValueError: Expect <class 'bool'>, got Standard (<class 'str'>)

cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback: az_command_data_logger: The command failed with an unexpected error. Here is the traceback: cli.azure.cli.core.azclierror: Expect <class 'bool'>, got Standard (<class 'str'>) Traceback (most recent call last): File "/usr/lib64/az/lib/python3.9/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 666, in execute raise ex File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 733, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 703, in _run_job result = cmd_copy(params) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_command.py", line 155, in call return self._handler(*args, kwargs) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/lab/aaz/latest/lab/_create_environment.py", line 49, in _handler super()._handler(command_args) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_command.py", line 159, in _handler self.ctx = AAZCommandCtx( File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_command_ctx.py", line 30, in init cmd_arg.apply(self.args, dest) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_arg_action.py", line 58, in apply self._assign_data(args, data, dest, keys) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_arg_action.py", line 73, in _assign_data arg[key] = data File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_field_value.py", line 76, in setitem self._data[name] = attr_schema.process_data(data, key=name) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_field_type.py", line 48, in process_data raise AAZInvalidValueError('Expect {}, got {} ({})'.format(self.DataType, data, type(data))) azure.cli.core.aaz.exceptions.AAZInvalidValueError: Expect <class 'bool'>, got Standard (<class 'str'>) az_command_data_logger: Expect <class 'bool'>, got Standard (<class 'str'>) Traceback (most recent call last): File "/usr/lib64/az/lib/python3.9/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 666, in execute raise ex File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 733, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 703, in _run_job result = cmd_copy(params) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_command.py", line 155, in call return self._handler(args, kwargs) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/lab/aaz/latest/lab/_create_environment.py", line 49, in _handler super()._handler(command_args) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_command.py", line 159, in _handler self.ctx = AAZCommandCtx( File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_command_ctx.py", line 30, in init cmd_arg.apply(self.args, dest) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_arg_action.py", line 58, in apply self._assign_data(args, data, dest, *keys) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_arg_action.py", line 73, in _assign_data arg[key] = data File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_field_value.py", line 76, in setitem self._data[name] = attr_schema.process_data(data, key=name) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_field_type.py", line 48, in process_data raise AAZInvalidValueError('Expect {}, got {} ({})'.format(self.DataType, data, type(data))) azure.cli.core.aaz.exceptions.AAZInvalidValueError: Expect <class 'bool'>, got Standard (<class 'str'>) To check existing issues, please visit: https://github.com/Azure/azure-cli/issues cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f954d4809d0>] az_command_data_logger: exit code: 1 cli.main: Command ran in 0.379 seconds (init: 0.112, invoke: 0.267) telemetry.main: Begin splitting cli events and extra events, total events: 1 telemetry.client: Accumulated 0 events. Flush the clients. telemetry.main: Finish splitting cli events and extra events, cli events: 1 telemetry.save: Save telemetry record of length 8270 in cache file under /home/reply_shubhangi/.azure/telemetry/20241125155927633 telemetry.main: Begin creating telemetry upload process. telemetry.process: Creating upload process: "/usr/bin/python3.9 /usr/lib/az/lib/python3.9/site-packages/azure/cli/telemetry/init.py /home/reply_shubhangi/.azure /home/reply_shubhangi/.azure/telemetry/20241125155927633" telemetry.process: Return from creating process 537 telemetry.main: Finish creating telemetry upload process. PS /home/reply_shubhangi>

Expected behavior

with the command which worked on AZCLI version 2.64 , the corresponding action would expect a lab to be created on the Azure portal

Environment Summary

azure-cli 2.65.0 *

core 2.65.0 * telemetry 1.1.0

Extensions: ai-examples 0.2.5 ml 2.30.1 ssh 2.0.5

Dependencies: msal 1.31.0 azure-mgmt-resource 23.1.1

Python location '/usr/bin/python3.9' Extensions directory '/home/reply_shubhangi/.azure/cliextensions' Extensions system directory '/usr/lib/python3.9/site-packages/azure-cli-extensions'

Python (Linux) 3.9.19 (main, Aug 23 2024, 00:07:48) [GCC 11.2.0]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

No response

azure-client-tools-bot-prd[bot] commented 5 days ago

Hi @shmohanty,

2.65.0 is not the latest Azure CLI(2.67.0).

If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.

yonzhan commented 5 days ago

Thank you for opening this issue, we will look into it.

microsoft-github-policy-service[bot] commented 5 days ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @anishtrakru, @derekbekoe.

shmohanty commented 4 days ago

I updated the az cli version to 2.67 and I am still getting the same error : C:\Users\shmohanty>az lab vm create --resource-group 'WEU-GEN-Dev-16' --lab-name 'WEU-GEN-Dev-16' --name 'MJHTest1' --admin-username 'pwAtpUser' --admin-password 'MJHTest1' --image-type gallery --size 'Standard_B4ms' --disk-type Standard --vnet-name 'WEU-GEN-Dev-16' --subnet 'WEU-General' --ip-configuration private This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus The command failed with an unexpected error. Here is the traceback: Expect <class 'bool'>, got Standard (<class 'str'>) Traceback (most recent call last): File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 666, in execute File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 733, in _run_jobs_serially File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 703, in _run_job File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command.py", line 155, in call File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/lab/aaz/latest/lab/_create_environment.py", line 49, in _handler File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command.py", line 159, in _handler File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command_ctx.py", line 30, in init File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_action.py", line 58, in apply File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_arg_action.py", line 73, in _assign_data File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 77, in setitem File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 49, in process_data azure.cli.core.aaz.exceptions.AAZInvalidValueError: Expect <class 'bool'>, got Standard (<class 'str'>)

Dxaz commented 2 days ago

@shmohanty Thank you for reporting this, I went ahead and found the issue and proposed a fix to the team for review. You may see it this fixed in December, but most likely will be relased in January due to the holiday if approved and merged. We'll see.