Blob Blame Raw
From aa3bf5cc195b1e36e5aa8eda2cd7bfc4f192a0d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joakim=20L=C3=B6fgren?= <joakim.lofgren@gmail.com>
Date: Mon, 22 Feb 2016 12:50:47 +0100
Subject: [PATCH] Fix issue with non-ascii characters in get_job_md5

The xml string needs to be encoded to utf-8
before passing it to the hash function.

Change-Id: I4b6ca7ef459b48a2ba56f788fe37307ee381ced4
Story: 2000488
---
 jenkins_jobs/builder.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jenkins_jobs/builder.py b/jenkins_jobs/builder.py
index 6e257bb..28901b5 100644
--- a/jenkins_jobs/builder.py
+++ b/jenkins_jobs/builder.py
@@ -158,7 +158,7 @@ class Jenkins(object):
 
     def get_job_md5(self, job_name):
         xml = self.jenkins.get_job_config(job_name)
-        return hashlib.md5(xml).hexdigest()
+        return hashlib.md5(xml.encode('utf-8')).hexdigest()
 
     def delete_job(self, job_name):
         if self.is_job(job_name):
-- 
2.7.3