{Misc.} Remove unreachable code for creating SSL context#31919
{Misc.} Remove unreachable code for creating SSL context#31919
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 removes unreachable code that handled SSL context creation for older Python versions and Windows Cloud Shell environments. Since Azure CLI now requires Python 3.9+ and Windows Cloud Shell doesn't exist, the conditional branches checking for Python < 3.4 and Windows Cloud Shell are no longer needed.
- Removes conditional logic for Python version checks (< 3.4) and Windows Cloud Shell detection
- Simplifies SSL context creation by directly using
ssl.create_default_context() - Cleans up duplicate
_ssl_context()function implementations across multiple modules
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/appservice/custom.py | Removes unreachable SSL context fallback code |
| src/azure-cli/azure/cli/command_modules/acs/custom.py | Removes unreachable SSL context fallback code |
| src/azure-cli/azure/cli/command_modules/acr/helm.py | Removes unreachable SSL context fallback code and unused sys import |
| src/azure-cli-core/azure/cli/core/util.py | Removes unreachable SSL context fallback code |
Comments suppressed due to low confidence (1)
src/azure-cli/azure/cli/command_modules/acr/helm.py:368
- The
import sysstatement is no longer needed since the sys.version_info check was removed. This unused import should be deleted.
def _ssl_context():
|
ACR: @trisavo-msft App Service: @kumaramit-msft Could you please help review this PR? |
Description
Azure CLI now only supports Python 3.9+:
azure-cli/src/azure-cli-core/setup.py
Line 85 in d7e8a34
and there is no Windows Cloud Shell, so this piece of code will never be hit.
For code cleanness, this PR removes the unreachable code.