Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traffic-manager endpoint create: Parsing issue with --min-child-endpoints, --min-child-ipv4, --min-child-ipv6 #26638

Closed
Angel-AG opened this issue Jun 8, 2023 · 1 comment · Fixed by #26641
Assignees
Labels
Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team bug This issue requires a change to an existing behavior in the product in order to be resolved. Network az network vnet/lb/nic/dns/etc...
Milestone

Comments

@Angel-AG
Copy link

Angel-AG commented Jun 8, 2023

Describe the bug

Unable to create an endpoint when specifying any of: --min-child-endpoints, --min-child-ipv4, --min-child-ipv6.
The command fails with:
Expect <class 'int'>, got <class 'str'>

Related command

az network traffic-manager endpoint create --name {} --profile-name {} --resource-group {} --type nestedEndpoints --endpoint-status Enabled --target-resource-id {} --min-child-endpoints 1 --min-child-ipv4 1 --min-child-ipv6 1 --priority 3 --subscription {}

Errors

The command failed with an unexpected error. Here is the traceback:
Expect <class 'int'>, got 1 (<class 'str'>)
Traceback (most recent call last):
  File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/network/custom.py", line 5254, in create_traffic_manager_endpoint
    return Create_Endpoint(args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/aaz/_command.py", line 149, in __call__
    return self._handler(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/network/aaz/latest/network/traffic_manager/endpoint/_create.py", line 35, in _handler
    super()._handler(command_args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/aaz/_command.py", line 153, in _handler
    self.ctx = AAZCommandCtx(
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/aaz/_command_ctx.py", line 32, in __init__
    self.args[dest] = cmd_arg
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
    self._data[name] = attr_schema.process_data(data, key=name)
  File "/opt/az/lib/python3.10/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 'int'>, got 1 (<class 'str'>)

Issue script & Debug output

cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f8d6b337f40>, <function CLIQuery.handle_query_parameter at 0x7f8d6b3851b0>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x7f8d6a40d630>]
cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/network/custom.py", line 5254, in create_traffic_manager_endpoint
    return Create_Endpoint(args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/aaz/_command.py", line 149, in __call__
    return self._handler(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/network/aaz/latest/network/traffic_manager/endpoint/_create.py", line 35, in _handler
    super()._handler(command_args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/aaz/_command.py", line 153, in _handler
    self.ctx = AAZCommandCtx(
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/aaz/_command_ctx.py", line 32, in __init__
    self.args[dest] = cmd_arg
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
    self._data[name] = attr_schema.process_data(data, key=name)
  File "/opt/az/lib/python3.10/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 'int'>, got 1 (<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 'int'>, got 1 (<class 'str'>)
Traceback (most recent call last):
  File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/network/custom.py", line 5254, in create_traffic_manager_endpoint
    return Create_Endpoint(args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/aaz/_command.py", line 149, in __call__
    return self._handler(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/network/aaz/latest/network/traffic_manager/endpoint/_create.py", line 35, in _handler
    super()._handler(command_args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/aaz/_command.py", line 153, in _handler
    self.ctx = AAZCommandCtx(
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/aaz/_command_ctx.py", line 32, in __init__
    self.args[dest] = cmd_arg
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
    self._data[name] = attr_schema.process_data(data, key=name)
  File "/opt/az/lib/python3.10/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 'int'>, got 1 (<class 'str'>)
az_command_data_logger: Expect <class 'int'>, got 1 (<class 'str'>)
Traceback (most recent call last):
  File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/network/custom.py", line 5254, in create_traffic_manager_endpoint
    return Create_Endpoint(args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/aaz/_command.py", line 149, in __call__
    return self._handler(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/network/aaz/latest/network/traffic_manager/endpoint/_create.py", line 35, in _handler
    super()._handler(command_args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/aaz/_command.py", line 153, in _handler
    self.ctx = AAZCommandCtx(
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/aaz/_command_ctx.py", line 32, in __init__
    self.args[dest] = cmd_arg
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
    self._data[name] = attr_schema.process_data(data, key=name)
  File "/opt/az/lib/python3.10/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 'int'>, got 1 (<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 0x7f8d6a37edd0>]
cli.__main__: Command ran in 0.699 seconds (init: 0.167, invoke: 0.532)

Expected behavior

Succeed and return json values.
Example:

{
  "alwaysServe": "Disabled",
  "endpointMonitorStatus": "Stopped",
  "endpointStatus": "Enabled",
  "id": "some-id",
  "minChildEndpoints": 1,
  "minChildEndpointsIPv4": 1,
  "minChildEndpointsIPv6": 1,
  "name": "some-name",
  "priority": 3,
  "resourceGroup": "some-resource-group",
  "target": "some-target",
  "targetResourceId": "some-target-resource-id",
  "type": "Microsoft.Network/trafficManagerProfiles/nestedEndpoints",
  "weight": 1
}

Environment Summary

azure-cli                         2.49.0

core                              2.49.0
telemetry                          1.0.8

Extensions:
acrtransfer                        1.1.0
aks-preview                      0.5.141
azure-devops                      0.26.0
virtual-wan                       0.2.17

Dependencies:
msal                              1.20.0
azure-mgmt-resource               22.0.0

Python location '/opt/az/bin/python3'
Extensions directory '/home/angelgh/.azure/cliextensions'
Extensions system directory '/opt/az/lib/python3.10/site-packages/azure-cli-extensions'

Python (Linux) 3.10.10 (main, May 19 2023, 08:20:32) [GCC 9.4.0]

Additional context

This issue seems similar to the following issues:

Those were fixed by:

A quick look seems to indicate issue is the same with --min-child-endpoints, --min-child-ipv4, and --min-child-ipv6.
Adding type=int might fix it.

@Angel-AG Angel-AG added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Jun 8, 2023
@ghost ghost added the Network az network vnet/lb/nic/dns/etc... label Jun 8, 2023
@ghost ghost added this to the Backlog milestone Jun 8, 2023
@ghost ghost assigned necusjz Jun 8, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Jun 8, 2023

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

@ghost ghost added Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jun 8, 2023
@yonzhan yonzhan removed the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label Jun 8, 2023
necusjz added a commit that referenced this issue Jun 21, 2023
…`--min-child-endpoints`, `--min-child-ipv4` and `--min-child-ipv6` as integer type (#26641)
avgale pushed a commit to avgale/azure-cli that referenced this issue Aug 24, 2023
…lare `--min-child-endpoints`, `--min-child-ipv4` and `--min-child-ipv6` as integer type (Azure#26641)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team bug This issue requires a change to an existing behavior in the product in order to be resolved. Network az network vnet/lb/nic/dns/etc...
Projects
None yet
3 participants