msinhore opened a new pull request, #7575:
URL: https://github.com/apache/cloudstack/pull/7575

   This PR removes the dependency on the deprecated method SmartConnectNoSSL 
from the pyVim.connect module. The pyVmomi library removed this method in newer 
versions, leading to errors when trying to import it.
   
   Instead of using SmartConnectNoSSL, I have modified the code to use 
SmartConnect with a custom SSL context when SSL verification is disabled. 
Python has an inbuilt method to create an SSL context that does not verify the 
authenticity of the SSL certificate, ssl._create_unverified_context(). This 
method is used to create a context which is passed to SmartConnect.
   
   The following changes were made to the code:
   
   Import of ssl added at the top of the file.
   SmartConnectNoSSL was removed from the imports from the pyVim.connect 
module. Modified the block of code where SmartConnect or SmartConnectNoSSL was 
used to create a service instance. It now creates an unverified SSL context if 
the disable_ssl_verification option is set and Python supports creating 
unverified SSL contexts. This context is then passed to SmartConnect. This PR 
helps to maintain compatibility with newer versions of pyVmomi and avoids using 
deprecated methods.
   
   Finally, it should be noted that disabling SSL verification can lead to 
potential security issues. This option should be used with care and preferably 
in a testing or development environment.
   
   ### Description
   
   This PR...
   <!--- Describe your changes in DETAIL - And how has behaviour functionally 
changed. -->
   
   <!-- For new features, provide link to FS, dev ML discussion etc. -->
   <!-- In case of bug fix, the expected and actual behaviours, steps to 
reproduce. -->
   
   <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be 
closed when this PR gets merged -->
   <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
   <!-- Fixes: # -->
   
   <!--- 
*********************************************************************************
 -->
   <!--- NOTE: AUTOMATATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE 
DOCUMENTATION. -->
   <!--- PLEASE PUT AN 'X' in only **ONE** box -->
   <!--- 
*********************************************************************************
 -->
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [ ] Minor
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [ ] Minor
   - [ ] Trivial
   
   
   ### Screenshots (if appropriate):
   
   
   ### How Has This Been Tested?
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to 
-->
   <!-- see how your change affects other areas of the code, etc. -->
   
   
   <!-- Please read the 
[CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) 
document -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to