1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-20 10:48:59 +00:00

[PR #11078/dcb580c4 backport][stable-12] discard Python 2 ssl handling (#11086)

discard Python 2 ssl handling (#11078)

* discard Python 2 ssl handling

* add changelog frag

* Apply suggestion



---------


(cherry picked from commit dcb580c41d)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot] 2025-11-10 21:50:40 +01:00 committed by GitHub
parent b593c673b1
commit 9db4aad986
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 10 additions and 41 deletions

View file

@ -110,22 +110,10 @@ def main():
start = now()
ssl_context = None
if not validate_certs:
try:
ssl_context = ssl._create_unverified_context()
except AttributeError:
# Legacy Python that doesn't verify HTTPS certificates by default
pass
else:
# Handle target environment that doesn't support HTTPS verification
ssl._create_default_https_context = ssl._create_unverified_context
ssl_context = None if validate_certs or not use_ssl else ssl._create_unverified_context()
url = "{proto}://{host}:{port}/cobbler_api".format(**module.params)
if ssl_context:
conn = xmlrpc_client.ServerProxy(url, context=ssl_context)
else:
conn = xmlrpc_client.Server(url)
conn = xmlrpc_client.ServerProxy(url, context=ssl_context)
try:
token = conn.login(username, password)