Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
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>
|
az storage file list: Fix file list for nfs shares, as --include is not supportedaz storage file list: Fix file list for nfs shares, as --include is not supported
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in the az storage file list command where the --include parameter was being used with NFS file shares, which don't support this parameter. The fix adds logic to check the share protocol type and only includes extended file information for SMB shares.
Key changes:
- Modified
list_share_filesfunction to check share protocol type before settingincludeparameter - Added test coverage for file listing on NFS shares
- Updated test recordings to reflect the new behavior
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/storage/operations/file.py | Added protocol check logic to conditionally set include parameter based on share type (SMB vs NFS) |
| src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_file_scenarios.py | Added test assertions to verify file listing works correctly for NFS shares |
| src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_file_share_nfs_scenario.yaml | Added test recordings for new NFS file list operations |
| src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_file_main_scenario.yaml | Updated test recordings to reflect share properties check before file listing |
| src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_file_main_oauth_scenario.yaml | Updated test recordings to reflect share properties check before file listing with OAuth authentication |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| include = [] if exclude_extended_info else ["timestamps", "Etag", "Attributes", "PermissionKey"] | ||
| include = None | ||
| share_properties = client.get_share_properties() | ||
| if share_properties.protocols == ['SMB']: |
There was a problem hiding this comment.
The protocol comparison share_properties.protocols == ['SMB'] may fail if the protocols list contains multiple values or is in a different order. Consider using 'SMB' in share_properties.protocols for more robust protocol checking.
| if share_properties.protocols == ['SMB']: | |
| if 'SMB' in share_properties.protocols: |
| include = None | ||
| share_properties = client.get_share_properties() | ||
| if share_properties.protocols == ['SMB']: | ||
| include = [] if exclude_extended_info else ["timestamps", "Etag", "Attributes", "PermissionKey"] |
There was a problem hiding this comment.
Shall we warn/error out for nfs shares when exclude_extended_info is specified?
Related command
Description
Previously smb file shares support --include, the new nfs shares do not, so checking the share type before listing.
Testing Guide
History Notes
[Storage]
az storage file list: Fix file list for nfs shares, as--includeis not supportedThis 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.