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

{Event Grid} Fix TypeError when specifying numerical CLI arguments for certain topic types #17872

Merged
merged 1 commit into from
Apr 27, 2021
Merged

{Event Grid} Fix TypeError when specifying numerical CLI arguments for certain topic types #17872

merged 1 commit into from
Apr 27, 2021

Conversation

wiebeck
Copy link
Contributor

@wiebeck wiebeck commented Apr 26, 2021

Description
Commit acd4633 removed the manual casting to int for several cli arguments and fixed that in the argument definition by specifying type=int but forgot to do the same for other sets of arguments (system and partner topics).

My GitHub workflow contains a run step with the following command:

az eventgrid system-topic event-subscription create \
  --name blobeventgrid \
  --resource-group $RESOURCE_GROUP \
  --system-topic-name evto-connect-${{ env.ENVIRONMENT }} \
  --deadletter-endpoint "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP/providers/Microsoft.Storage/storageAccounts/$STORAGEACCOUNTNAME/blobServices/default/containers/XXX" \
  --endpoint "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP/providers/Microsoft.Web/sites/$FUNCTION/functions/XXX" \
  --endpoint-type azurefunction \
  --event-ttl 360 \
  --max-delivery-attempts 10 \
  --included-event-types "Microsoft.Storage.BlobCreated" \
  --subject-ends-with ".xml" \
  --labels "github-actions"

Until now this always worked as expected. GitHubs base image for workflows recently updated to Azure CLI v2.22.0 and since then I got:

ERROR: '<' not supported between instances of 'str' and 'int'
Traceback (most recent call last):
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
    raise ex
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 807, in default_command_handler
    return op(**command_args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/eventgrid/custom.py", line 683, in cli_system_topic_event_subscription_create_or_update
    delivery_attribute_mapping=delivery_attribute_mapping)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/eventgrid/custom.py", line 952, in _get_event_subscription_info
    _validate_retry_policy(max_delivery_attempts, event_ttl)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/eventgrid/custom.py", line 1547, in _validate_retry_policy
    if max_delivery_attempts < 1 or max_delivery_attempts > 30:
TypeError: '<' not supported between instances of 'str' and 'int'

Testing Guide
Just enter any az eventgrid system-topic event-subscription create command while specifying one of max-delivery-attempts, max-events-per-batch, preferred-batch-size-in-kilobytes or event-ttl.


This checklist is used to make sure that common guidelines for a pull request are followed.

Commit acd4633 removed the manual casting to int for several cli arguments and fixed that in the argument definition but forgot to do the same for other sets of arguments (system and partner topics).
@ghost ghost added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Apr 26, 2021
@ghost
Copy link

ghost commented Apr 26, 2021

Thank you for your contribution wiebeck! We will review the pull request and get back to you soon.

@ghost
Copy link

ghost commented Apr 26, 2021

CLA assistant check
All CLA requirements met.

@yonzhan yonzhan added this to the S186 milestone Apr 26, 2021
@yonzhan
Copy link
Collaborator

yonzhan commented Apr 26, 2021

Event Grid

@evelyn-ys evelyn-ys changed the title [Event Grid] Fix TypeError when specifying numerical CLI arguments for certain topic types {Event Grid} Fix TypeError when specifying numerical CLI arguments for certain topic types Apr 27, 2021
@evelyn-ys evelyn-ys merged commit 71c6a9f into Azure:dev Apr 27, 2021
@wiebeck wiebeck deleted the fix_event_grid_params branch April 27, 2021 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants