Skip to content

[Storage] az storage file list: Fix file list for nfs shares, as --include is not supported#32268

Merged
calvinhzy merged 4 commits intoAzure:devfrom
calvinhzy:storage-file-list-nfs-fix
Oct 24, 2025
Merged

[Storage] az storage file list: Fix file list for nfs shares, as --include is not supported#32268
calvinhzy merged 4 commits intoAzure:devfrom
calvinhzy:storage-file-list-nfs-fix

Conversation

@calvinhzy
Copy link
Copy Markdown
Member

@calvinhzy calvinhzy commented Oct 16, 2025

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 --include is not supported


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

@calvinhzy calvinhzy self-assigned this Oct 16, 2025
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Oct 16, 2025

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Oct 16, 2025

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Oct 16, 2025

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

@github-actions
Copy link
Copy Markdown

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).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@calvinhzy calvinhzy changed the title [Storage] az storage file list: Fix file list for nfs shares, as --include is not supported [Storage] az storage file list: Fix file list for nfs shares, as --include is not supported Oct 16, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the Auto-Assign Auto assign by bot label Oct 16, 2025
@calvinhzy calvinhzy marked this pull request as ready for review October 17, 2025 03:03
Copilot AI review requested due to automatic review settings October 17, 2025 03:03
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 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_files function to check share protocol type before setting include parameter
  • 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']:
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
if share_properties.protocols == ['SMB']:
if 'SMB' in share_properties.protocols:

Copilot uses AI. Check for mistakes.
include = None
share_properties = client.get_share_properties()
if share_properties.protocols == ['SMB']:
include = [] if exclude_extended_info else ["timestamps", "Etag", "Attributes", "PermissionKey"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we warn/error out for nfs shares when exclude_extended_info is specified?

@calvinhzy calvinhzy requested a review from evelyn-ys October 23, 2025 01:33
@calvinhzy calvinhzy merged commit 0d21ec8 into Azure:dev Oct 24, 2025
48 checks passed
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 Storage az storage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants