File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from __future__ import print_function
22import os
3- from time import time , sleep
3+ import sys
44import datetime
5+ from time import time , sleep
56import jenkins
67import socket
78from xml .etree import ElementTree
@@ -64,6 +65,10 @@ def get_jobs_legend():
6465 return legend
6566
6667
68+ def xml_to_string (root ):
69+ return ElementTree .tostring (root , encoding = ('unicode' if sys .version_info [0 ] == 3 else None ))
70+
71+
6772class CliException (Exception ):
6873 pass
6974
@@ -192,7 +197,7 @@ def setbranch(self, args):
192197 scm_name , branch_node = self ._get_scm_name_and_node (root )
193198 if branch_node is not None :
194199 branch_node .text = args .branch_name
195- new_xml = ElementTree . tostring (root , encoding = 'unicode' )
200+ new_xml = xml_to_string (root )
196201 self .jenkins .reconfig_job (job_name , new_xml )
197202 print ('Done' )
198203 else :
You can’t perform that action at this time.
0 commit comments