Managed Network Fabric CLI- Fix output formatting for resync-password and rotate-certificate commands#9755
Managed Network Fabric CLI- Fix output formatting for resync-password and rotate-certificate commands#9755nafizhaider32 wants to merge 5 commits intoAzure:mainfrom
Conversation
️✔️Azure CLI Extensions Breaking Change Test
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
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>
|
CodeGen Tools Feedback CollectionThank you for using our CodeGen tool. We value your feedback, and we would like to know how we can improve our product. Please take a few minutes to fill our codegen survey |
|
There was a problem hiding this comment.
Pull request overview
This PR updates the managednetworkfabric Azure CLI extension to improve user-facing output for the networkfabric {fabric|device} resync-password and networkfabric fabric rotate-certificate commands by removing duplicated nested error details and improving LRO error message formatting.
Changes:
- Bump extension version to 9.1.1 and add release notes.
- Add an
ErrorFormathelper to (a) strip nesteddetailsfrom successful/partial-success responses and (b) formatHttpResponseErrordetail blocks with readable separators. - Override the three affected commands with custom subclasses and add unit tests for the new behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/managednetworkfabric/setup.py | Bumps extension version to 9.1.1. |
| src/managednetworkfabric/HISTORY.rst | Adds 9.1.1 release notes describing the formatting fix. |
| src/managednetworkfabric/azext_managednetworkfabric/operations/error_format.py | Introduces shared output/error-message formatting helper. |
| src/managednetworkfabric/azext_managednetworkfabric/custom/device_resync_password.py | Custom command override to apply new formatting. |
| src/managednetworkfabric/azext_managednetworkfabric/custom/fabric_resync_password.py | Custom command override to apply new formatting. |
| src/managednetworkfabric/azext_managednetworkfabric/custom/fabric_rotate_certificate.py | Custom command override to apply new formatting. |
| src/managednetworkfabric/azext_managednetworkfabric/commands.py | Registers the custom command classes to override generated AAZ commands. |
| src/managednetworkfabric/azext_managednetworkfabric/tests/unit/test_error_format.py | Adds unit tests for ErrorFormat output/message behavior. |
| src/managednetworkfabric/azext_managednetworkfabric/tests/unit/test_custom_commands.py | Adds unit tests for the custom command overrides. |
| src/managednetworkfabric/azext_managednetworkfabric/custom/init.py | Introduces a custom package (currently conflicting with existing custom.py). |
| src/managednetworkfabric/azext_managednetworkfabric/tests/unit/init.py | Adds unit test package marker. |
src/managednetworkfabric/azext_managednetworkfabric/custom/device_resync_password.py
Show resolved
Hide resolved
src/managednetworkfabric/azext_managednetworkfabric/custom/fabric_resync_password.py
Show resolved
Hide resolved
src/managednetworkfabric/azext_managednetworkfabric/custom/fabric_rotate_certificate.py
Show resolved
Hide resolved
src/managednetworkfabric/azext_managednetworkfabric/tests/unit/test_custom_commands.py
Outdated
Show resolved
Hide resolved
…, remove unused import - Add no_wait check in _handler for device_resync_password, fabric_resync_password, and fabric_rotate_certificate to return poller directly when --no-wait is set - Add backward-compatible loading of legacy custom.py in custom/__init__.py to prevent module/package name collision - Remove unused MagicMock import from test_custom_commands.py - Add test_handler_returns_poller_on_no_wait test for all three command classes - Mock ctx.args.no_wait in existing tests that call _handler Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add pylint disable=no-name-in-module to custom submodule imports in commands.py. The errors are false positives caused by the custom.py / custom/ package name collision that confuses pylint's module resolution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install wheel==0.30.0required)For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update
src/index.jsonautomatically.You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify
src/index.json.