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>
This commit is contained in:
Achim Leitner 2019-08-08 10:12:23 +02:00
parent 079900b4e7
commit cbc6819978

View File

@ -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):