Fix python 3 compatibility (#41645)

pull/46646/merge
Benoit Dunand-Laisin 6 years ago committed by ansibot
parent a3a595e60a
commit 19deb6b49e

@ -264,7 +264,7 @@ state:
from ansible.module_utils.basic import AnsibleModule, to_bytes from ansible.module_utils.basic import AnsibleModule, to_bytes
from ansible.module_utils.six.moves.urllib.parse import urlencode from ansible.module_utils.six.moves.urllib.parse import urlencode
from ansible.module_utils.urls import fetch_url, url_argument_spec from ansible.module_utils.urls import fetch_url, url_argument_spec
from ansible.module_utils._text import to_native from ansible.module_utils._text import to_native, text_type, binary_type
import base64 import base64
import hashlib import hashlib
import json import json
@ -610,7 +610,7 @@ class JenkinsPlugin(object):
# Store the plugin into a temp file and then move it # Store the plugin into a temp file and then move it
tmp_f_fd, tmp_f = tempfile.mkstemp() tmp_f_fd, tmp_f = tempfile.mkstemp()
if isinstance(data, str): if isinstance(data, (text_type, binary_type)):
os.write(tmp_f_fd, data) os.write(tmp_f_fd, data)
else: else:
os.write(tmp_f_fd, data.read()) os.write(tmp_f_fd, data.read())

Loading…
Cancel
Save