From 5195536bd8ffb0cfa89d87ff7ca7a2c9eb646d7f Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Mon, 26 Apr 2021 06:56:21 +0200 Subject: [PATCH] Fix Python 2 compatibility issue. (#2340) --- changelogs/fragments/2340-jenkins_plugin-py2.yml | 2 ++ plugins/modules/web_infrastructure/jenkins_plugin.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/2340-jenkins_plugin-py2.yml diff --git a/changelogs/fragments/2340-jenkins_plugin-py2.yml b/changelogs/fragments/2340-jenkins_plugin-py2.yml new file mode 100644 index 0000000000..f3bcdbd361 --- /dev/null +++ b/changelogs/fragments/2340-jenkins_plugin-py2.yml @@ -0,0 +1,2 @@ +bugfixes: +- "jenkins_plugin - fixes Python 2 compatibility issue (https://github.com/ansible-collections/community.general/pull/2340)." \ No newline at end of file diff --git a/plugins/modules/web_infrastructure/jenkins_plugin.py b/plugins/modules/web_infrastructure/jenkins_plugin.py index e2adf7a69d..c9946023ac 100644 --- a/plugins/modules/web_infrastructure/jenkins_plugin.py +++ b/plugins/modules/web_infrastructure/jenkins_plugin.py @@ -276,6 +276,7 @@ from ansible.module_utils.six import text_type, binary_type from ansible.module_utils._text import to_native import base64 import hashlib +import io import json import os import tempfile @@ -560,7 +561,7 @@ class JenkinsPlugin(object): # Open the updates file try: - f = open(updates_file, encoding='utf-8') + f = io.open(updates_file, encoding='utf-8') except IOError as e: self.module.fail_json( msg="Cannot open temporal updates file.",