From 19deb6b49e81cf4901ceb827149ee9576db3414a Mon Sep 17 00:00:00 2001 From: Benoit Dunand-Laisin Date: Tue, 9 Oct 2018 00:30:05 +0200 Subject: [PATCH] Fix python 3 compatibility (#41645) --- lib/ansible/modules/web_infrastructure/jenkins_plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/web_infrastructure/jenkins_plugin.py b/lib/ansible/modules/web_infrastructure/jenkins_plugin.py index e665c63318e..335835162a4 100644 --- a/lib/ansible/modules/web_infrastructure/jenkins_plugin.py +++ b/lib/ansible/modules/web_infrastructure/jenkins_plugin.py @@ -264,7 +264,7 @@ state: from ansible.module_utils.basic import AnsibleModule, to_bytes 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._text import to_native +from ansible.module_utils._text import to_native, text_type, binary_type import base64 import hashlib import json @@ -610,7 +610,7 @@ class JenkinsPlugin(object): # Store the plugin into a temp file and then move it tmp_f_fd, tmp_f = tempfile.mkstemp() - if isinstance(data, str): + if isinstance(data, (text_type, binary_type)): os.write(tmp_f_fd, data) else: os.write(tmp_f_fd, data.read())