-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Storage] Fix #22679: az storage account file-service-properties update: Fix AttributeError: 'NoneType' object has no attribute 'smb'
#22691
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
Conversation
…ror: 'NoneType' object has no attribute 'smb'`
|
Storage |
jiasli
left a comment
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.
I don't think this PR is a good idea.
If we implement this check, we should implement checks for all object properties, like this protocolSettings or shareDeleteRetentionPolicy, just in case they are suddenly missing from the API's response.
> az storage account file-service-properties show -n clitest23zhehg2ug7pzcmmt
{
"cors": {
"corsRules": []
},
"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/clitest47xrljy3nijo3qd5vzsdilpqy5gmhc6vhrxdt4iznh6uaopskftgp4scam2w7drpot4l/providers/Microsoft.Storage/storageAccounts/clitest23zhehg2ug7pzcmmt/fileServices/default",
"name": "default",
"protocolSettings": null,
"resourceGroup": "clitest47xrljy3nijo3qd5vzsdilpqy5gmhc6vhrxdt4iznh6uaopskftgp4scam2w7drpot4l",
"shareDeleteRetentionPolicy": {
"allowPermanentDelete": null,
"days": 0,
"enabled": false
},
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"type": "Microsoft.Storage/storageAccounts/fileServices"
}
Also, after API fixes this, the check for protocolSettings will be rendered useless.
|
This PR reminds me of #17526 where |
If we want to update sub property of azure-cli/src/azure-cli/azure/cli/command_modules/storage/operations/account.py Lines 737 to 738 in 05c00f9
Service won't "fix" API. They think return
We should do essential checks to make sure our product doesn't break frequently. That's quality requirements for our own product. We can't rely on the quality of external input. |
Then we need to be prepared that any object property can be I approved the PR, but I keep my personal opinion. |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Related command
az storage account file-service-properties updateDescription
Fix #22679 , IcM 311511171
update_file_service_propertiescan't handle properly wheninstance.protocol_settingsisNone.Previously
get_file_service_propertieswould get response"protocolSettings":{"smb":{}}from server.But recently server won't return
"protocalSettings"property any more.Then CLI would crash with
AttributeError: 'NoneType' object has no attribute 'smb'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.