[stable-2.9] Fix SSL protocol references in mqtt module. (#63654)

(cherry picked from commit 78eca0eb5d)

Co-authored-by: Matt Clay <matt@mystile.com>
pull/63863/head
Matt Clay 5 years ago committed by Matt Davis
parent db5382341d
commit 76c0a0825f

@ -0,0 +1,2 @@
bugfixes:
- Fix SSL protcol references in the ``mqtt`` module to prevent failures on Python 2.6.

@ -142,10 +142,17 @@ from ansible.module_utils._text import to_native
#
def main():
tls_map = {
'tlsv1.2': ssl.PROTOCOL_TLSv1_2,
'tlsv1.1': ssl.PROTOCOL_TLSv1_1,
}
tls_map = {}
try:
tls_map['tlsv1.2'] = ssl.PROTOCOL_TLSv1_2
except AttributeError:
pass
try:
tls_map['tlsv1.1'] = ssl.PROTOCOL_TLSv1_1
except AttributeError:
pass
module = AnsibleModule(
argument_spec=dict(

Loading…
Cancel
Save