-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[EventHubs] Fix #31108 and #32073 Regex updated for az eventhubs commands with --namespace-name arguments
#32472
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
base: dev
Are you sure you want to change the base?
Conversation
️✔️AzureCLI-FullTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
️✔️AzureCLI-BreakingChangeTest
|
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes validation issues (#31108 and #32073) with the --namespace-name argument in EventHubs commands. The regex pattern was incorrectly enforcing a minimum length of 8 and maximum of 52, while the documented constraints specify a minimum of 6 and maximum of 50 characters.
Key Changes:
- Updated regex pattern from
^[a-zA-Z][a-zA-Z0-9-]{6,50}[a-zA-Z0-9]$to^[a-zA-Z][a-zA-Z0-9-]{4,48}[a-zA-Z0-9]$ - This aligns the pattern with the declared
min_length=6andmax_length=50constraints - Applied consistently across all 13 affected command files
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/namespace/nsp_configuration/_show.py |
Updated namespace name validation pattern for nsp-configuration show command |
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/namespace/nsp_configuration/_list.py |
Updated namespace name validation pattern for nsp-configuration list command |
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/namespace/_wait.py |
Updated namespace name validation pattern for namespace wait command |
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/namespace/_update.py |
Updated namespace name validation pattern for namespace update command |
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/namespace/_show.py |
Updated namespace name validation pattern for namespace show command |
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/namespace/_failover.py |
Updated namespace name validation pattern for namespace failover command |
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/namespace/_delete.py |
Updated namespace name validation pattern for namespace delete command |
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/namespace/_create.py |
Updated namespace name validation pattern for namespace create command |
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/eventhub/_update.py |
Updated namespace name validation pattern for eventhub update command |
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/eventhub/_show.py |
Updated namespace name validation pattern for eventhub show command |
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/eventhub/_list.py |
Updated namespace name validation pattern for eventhub list command |
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/eventhub/_delete.py |
Updated namespace name validation pattern for eventhub delete command |
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/eventhub/_create.py |
Updated namespace name validation pattern for eventhub create command |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Related command
az eventhubs eventhub createaz eventhubs eventhub deleteaz eventhubs eventhub listaz eventhubs eventhub showaz eventhubs eventhub updateaz eventhubs namespace createaz eventhubs namespace deleteaz eventhubs namespace failoveraz eventhubs namespace showaz eventhubs namespace updateaz eventhubs namespace waitaz eventhubs namespace nsp-configuration listaz eventhubs namespace nsp-configuration showDescription
2 issues have been reported (#31108 and #32073) regarding the argument
--namespace-name. This argument has a min length defined at 6 and max at 50. But the regular expression provided to the pattern property doesn't match the min and max lengths.For example with a
--namespace-namevalue with a length equals to 7:az eventhubs namespace nsp-configuration list --namespace-name abc1234InvalidArgumentValue: --namespace-name: Invalid format: 'abc1234' does not fully match regular expression pattern '^[a-zA-Z][a-zA-Z0-9-]{6,50}[a-zA-Z0-9]$'The current regular expression min length is 8 and max 52.
Before:
To fix it, I modified it to have at the end a min at 6 and max at 50.
After:
Testing Guide
There are 3 tests to perform:
--namespace-namevalue length less than 6.--namespace-namevalue length equals to 6.--namespace-namevalue length more than 6.Before fix, with a
--namespace-namevalue length equals to 6:az eventhubs eventhub list --namespace-name abc123InvalidArgumentValue: --namespace-name: Invalid format: 'abc123' does not fully match regular expression pattern '^[a-zA-Z][a-zA-Z0-9-]{6,50}[a-zA-Z0-9]$'After fix, with a
--namespace-namevalue length equals to 6 (message expected because this resource doesn't exist):az eventhubs eventhub list --namespace-name abc123(ParentResourceNotFound) Failed to perform 'read' on resource(s) of type 'namespaces/eventhubs', because the parent resource '/subscriptions/.../resourceGroups/.../providers/Microsoft.EventHub/namespaces/abc123' could not be found. Code: ParentResourceNotFound Message: Failed to perform 'read' on resource(s) of type 'namespaces/eventhubs', because the parent resource '/subscriptions/.../resourceGroups/.../providers/Microsoft.EventHub/namespaces/abc123' could not be found.This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.