diff options
author | Toshio Kuratomi <a.badger@gmail.com> | 2017-01-03 22:50:58 -0800 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2017-01-04 00:34:52 -0800 |
commit | 3c4ac877f6eb6e010f62f5a21bcea0cff3964729 (patch) | |
tree | 9bb678ed67e1b0c0fc654fa986f1e8a2d47375c9 /lib | |
parent | 38bf7ab71f5238cde474457d383e35f05e4b6843 (diff) | |
download | ansible-3c4ac877f6eb6e010f62f5a21bcea0cff3964729.tar.gz |
Fix traceback on Darwin with Python3
os.write() needs bytes objects on python3 while python2 can work with
either a byte or unicode string. Mark the DUMMY_CA_CERT string as
a byte string so it will work.
Fixes #19265
Fixes #19266
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ansible/module_utils/urls.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/ansible/module_utils/urls.py b/lib/ansible/module_utils/urls.py index 68f78c0b8e..4320ba7b8b 100644 --- a/lib/ansible/module_utils/urls.py +++ b/lib/ansible/module_utils/urls.py @@ -309,7 +309,7 @@ if not HAS_MATCH_HOSTNAME: # ca cert, regardless of validity, for Python on Mac OS to use the # keychain functionality in OpenSSL for validating SSL certificates. # See: http://mercurial.selenic.com/wiki/CACertificates#Mac_OS_X_10.6_and_higher -DUMMY_CA_CERT = """-----BEGIN CERTIFICATE----- +b_DUMMY_CA_CERT = b("""-----BEGIN CERTIFICATE----- MIICvDCCAiWgAwIBAgIJAO8E12S7/qEpMA0GCSqGSIb3DQEBBQUAMEkxCzAJBgNV BAYTAlVTMRcwFQYDVQQIEw5Ob3J0aCBDYXJvbGluYTEPMA0GA1UEBxMGRHVyaGFt MRAwDgYDVQQKEwdBbnNpYmxlMB4XDTE0MDMxODIyMDAyMloXDTI0MDMxNTIyMDAy @@ -326,7 +326,7 @@ MUB80IR6knq9K/tY+hvPsZer6eFMzO3JGkRFBh2kn6JdMDnhYGX7AXVHGflrwNQH qFy+aenWXsC0ZvrikFxbQnX8GVtDADtVznxOi7XzFw7JOxdsVrpXgSN0eh0aMzvV zKPZsZ2miVGclicJHzm5q080b1p/sZtuKIEZk6vZqEg= -----END CERTIFICATE----- -""" +""") # # Exceptions @@ -603,7 +603,7 @@ class SSLValidationHandler(urllib_request.BaseHandler): # Write the dummy ca cert if we are running on Mac OS X if system == 'Darwin': - os.write(tmp_fd, DUMMY_CA_CERT) + os.write(tmp_fd, b_DUMMY_CA_CERT) # Default Homebrew path for OpenSSL certs paths_checked.append('/usr/local/etc/openssl') |