summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAchim Leitner <git@fjl.de>2019-08-08 10:12:23 +0200
committerAchim Leitner <git@fjl.de>2019-08-08 10:22:45 +0200
commitcbc6819978f5b33e1e8cdd08d9322e3a5d08c376 (patch)
tree92564c065fa50519f9d8ba9b2872b75fc175da27
parent079900b4e7e9f0bf384b50b49bbf83c7daad7d80 (diff)
downloadpython-jenkins-job-builder-cbc6819978f5b33e1e8cdd08d9322e3a5d08c376.tar.gz
python-jenkins-job-builder-cbc6819978f5b33e1e8cdd08d9322e3a5d08c376.tar.xz
python-jenkins-job-builder-cbc6819978f5b33e1e8cdd08d9322e3a5d08c376.zip
Fix encoding error in builder.py
When calling `jenkins-jobs update --delete`, the builder will create an XML dom tree from the xml string. It fails to correctly encode the string, which results in a UnicodeEncodeError if the string contains any non-ascii characters. Story: 2006374 Task: 36163 Change-Id: I2caf91dcaf2c1b6c03e92a485a3aa51b038b40b1 Signed-off-by: Achim Leitner <git@fjl.de>
-rw-r--r--jenkins_jobs/builder.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/jenkins_jobs/builder.py b/jenkins_jobs/builder.py
index 5d7bbe34..32c0c39b 100644
--- a/jenkins_jobs/builder.py
+++ b/jenkins_jobs/builder.py
@@ -181,7 +181,7 @@ class JenkinsManager(object):
def is_managed(self, job_name):
xml = self.jenkins.get_job_config(job_name)
try:
- out = XML.fromstring(xml)
+ out = XML.fromstring(xml.encode('utf-8'))
description = out.find(".//description").text
return description.endswith(MAGIC_MANAGE_STRING)
except (TypeError, AttributeError):