Skip to content
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

Command to wait for SQL Server state fails #12313

Closed
valterc opened this issue Feb 21, 2020 · 12 comments
Closed

Command to wait for SQL Server state fails #12313

valterc opened this issue Feb 21, 2020 · 12 comments
Assignees
Labels
Core CLI core infrastructure customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.

Comments

@valterc
Copy link

valterc commented Feb 21, 2020

Describe the bug

Using Azure CLI to wait for a SQL Server state fails with the following stack trace:

Command Name
az sql server wait

Errors:

'NoneType' object has no attribute 'casefold'
Traceback (most recent call last):
Temp\pip-install-3pnsb50r\knack\knack\cli.py, ln 206, in invoke
azure\cli\core\commands\__init__.py, ln 608, in execute
azure\cli\core\commands\__init__.py, ln 666, in _run_jobs_serially
azure\cli\core\commands\__init__.py, ln 659, in _run_job
Local\Temp\pip-install-3pnsb50r\six\six.py, ln 703, in reraise
azure\cli\core\commands\__init__.py, ln 636, in _run_job
azure\cli\core\commands\__init__.py, ln 306, in __call__
azure\cli\core\commands\arm.py, ln 684, in handler
AttributeError: 'NoneType' object has no attribute 'casefold'

To Reproduce:

Steps to reproduce the behavior:

  • az login
  • az account set --subscription {}
  • az sql server wait --name {} --resource-group {} --created

Expected Behavior

Command waits for a few seconds or returns immediately with no errors.

Environment Summary

Windows-10-10.0.18362-SP0
Python 3.6.6

azure-cli 2.1.0

Additional Context

@yonzhan yonzhan added the SQL az sql label Feb 22, 2020
@yonzhan yonzhan added the Service Attention This issue is responsible by Azure service team. label Feb 22, 2020
@ghost
Copy link

ghost commented Feb 22, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @azureSQLGitHub

@yonzhan
Copy link
Collaborator

yonzhan commented Feb 22, 2020

az sql

@a-vishar
Copy link

a-vishar commented Mar 2, 2020

Any update on this?

@jaredmoo
Copy link
Contributor

jaredmoo commented Mar 3, 2020

Error:

'NoneType' object has no attribute 'casefold'
Traceback (most recent call last):
Temp\pip-install-3pnsb50r\knack\knack\cli.py, ln 206, in invoke
azure\cli\core\commands\__init__.py, ln 608, in execute
azure\cli\core\commands\__init__.py, ln 666, in _run_jobs_serially
azure\cli\core\commands\__init__.py, ln 659, in _run_job
Local\Temp\pip-install-3pnsb50r\six\six.py, ln 703, in reraise
azure\cli\core\commands\__init__.py, ln 636, in _run_job
azure\cli\core\commands\__init__.py, ln 306, in __call__
azure\cli\core\commands\arm.py, ln 684, in handler
AttributeError: 'NoneType' object has no attribute 'casefold'  

Code:

               provisioning_state = get_provisioning_state(instance)
                # until we have any needs to wait for 'Failed', let us bail out on this
                if provisioning_state.casefold() == 'failed':
                    progress_indicator.stop()
                    raise CLIError('The operation failed')

@jaredmoo
Copy link
Contributor

jaredmoo commented Mar 3, 2020

Caused by #12154

@jaredmoo jaredmoo added ARM - Core and removed SQL az sql labels Mar 3, 2020
@ghost
Copy link

ghost commented Mar 3, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure

@jaredmoo
Copy link
Contributor

jaredmoo commented Mar 3, 2020

SQL server does not use provisioning state. Please fix this bug and implement automated test for az sql server wait (which should have been done when core team implemented this command, and would have prevented this regression).

@a-vishar
Copy link

Any update on this?

@jiasli
Copy link
Member

jiasli commented Mar 11, 2020

Fixed the regression with #12532

From the --debug log of az sql server wait, the sql server doesn't use "provisioningState": "Succeeded", but "state": "Ready".

{
    "kind": "v12.0",
    "properties": {
        "administratorLogin": "{}",
        "version": "12.0",
        "state": "Ready",
        "fullyQualifiedDomainName": "{}.database.windows.net",
        "privateEndpointConnections": [],
        "publicNetworkAccess": "Enabled"
    },
    "location": "eastus",
    "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/{}/providers/Microsoft.Sql/servers/{}",
    "name": "{}",
    "type": "Microsoft.Sql/servers"
}

Since wait is a generic ARM command, I am not sure whether we need to make an exception for SQL or add --ready since this will confuse customers using other commands like vm wait --created.

For now you may use custom query state=='Ready'

az sql server wait --resource-group {} --name {} --custom "state=='Ready'"

@jaredmoo @Juliehzl Any thoughts?

@azure-sdk azure-sdk added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Sep 24, 2020
@navba-MSFT
Copy link
Contributor

@valterc Apologies for the late reply. This github thread has been open for quite sometime. Could you please let us know if you are still looking for some assistance on this issue ?

@navba-MSFT navba-MSFT added the needs-author-feedback More information is needed from author to address the issue. label Feb 7, 2022
@valterc
Copy link
Author

valterc commented Feb 7, 2022

I haven't used that command in a while, not sure if the problem still remains. If it was fixed or if there's no more reports I guess it could be closed. Thank you.

@ghost ghost added needs-team-attention This issue needs attention from Azure service team or SDK team and removed needs-author-feedback More information is needed from author to address the issue. labels Feb 7, 2022
@navba-MSFT navba-MSFT removed the needs-team-attention This issue needs attention from Azure service team or SDK team label Feb 7, 2022
@navba-MSFT
Copy link
Contributor

@valterc As per the above comment this is fixed, Refer #12532. So with your permission we will now proceed with the closure of this thread. If you need any further assistance, feel free to reopen this thread. We could be happy to assist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core CLI core infrastructure customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

8 participants