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>
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds error handling around the external IP lookup and provides a clearer error message when the lookup fails in restricted environments.
- Wrapped the
get(IP_ADDRESS_CHECKER).textcall in a try/except and raise aCLIErrorwith guidance. - Added an inline explanatory comment for environments without public Internet access (USSec/USNat).
Comments suppressed due to low confidence (1)
src/azure-cli/azure/cli/command_modules/rdbms/flexible_server_virtual_network.py:466
- Consider adding a unit test that simulates a failure of the IP address checker to verify that this
CLIErroris raised with the expected message.
raise CLIError("Unable to detect your current IP address. Please provide a valid IP address or CIDR range for --public-access parameter or set --public-access Disabled. Error: {}".format(ex))
| try: | ||
| ''' | ||
| In USSec and USNat, the IP address checker is not available as the public Internet is not accessible. | ||
| When the user does not provide a public IP address or does not disble public access, |
There was a problem hiding this comment.
There is a typo in the comment: "disble" should be spelled "disable".
| When the user does not provide a public IP address or does not disble public access, | |
| When the user does not provide a public IP address or does not disable public access, |
| ''' | ||
| In USSec and USNat, the IP address checker is not available as the public Internet is not accessible. | ||
| When the user does not provide a public IP address or does not disble public access, | ||
| the `az cli postgres flexible-server create` command will fail with the error | ||
| HTTPSConnectionPool(host='api.ipify.org', port443): Max retries excceeded with url | ||
| ''' |
There was a problem hiding this comment.
Using a triple-quoted string as an inline comment can be confusing and is executed as a no-op literal. Consider replacing this with # comments for clarity.
| ''' | |
| In USSec and USNat, the IP address checker is not available as the public Internet is not accessible. | |
| When the user does not provide a public IP address or does not disble public access, | |
| the `az cli postgres flexible-server create` command will fail with the error | |
| HTTPSConnectionPool(host='api.ipify.org', port443): Max retries excceeded with url | |
| ''' | |
| # In USSec and USNat, the IP address checker is not available as the public Internet is not accessible. | |
| # When the user does not provide a public IP address or does not disable public access, | |
| # the `az cli postgres flexible-server create` command will fail with the error: | |
| # HTTPSConnectionPool(host='api.ipify.org', port=443): Max retries exceeded with URL. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
az postgresql flexible-server create: Handle failed IP address check
Related command
az postgresql flexible-server create
Description
If the IP address check to ipify.org fails, the server creation command fails with no explanation of how to resolve it. This will fail 100% of the time in USSec and USNat if the server is not VNet, the user does not provide an IP address or IP range, or the user does not specify that public access is disabled.
Testing Guide
History Notes
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.