job.update_config difficult to debug
def update_config(self, config):
"""
Update the config.xml to the job
Also refresh the ElementTree object since the config has changed
"""
url = self.get_config_xml_url()
try:
if isinstance(
config, unicode): # pylint: disable=undefined-variable
config = str(config)
except NameError:
# Python3 already a str
pass
response = self.jenkins.requester.post_url(url, params={}, data=config)
self._element_tree = ET.fromstring(config)
return response.text
I'm working on a script that massively updates jobs on a big Jenkins instance on Cloudbees, the thing is that apparently some update_config calls are silently dying (which, of course, the result is a job not updated), but it's difficult to debug since I'm only receiving response.text and I'm not getting any Exceptions when the update_config method fails. Also, response.text is always empty, no matter what.
Wouldn't be more useful if the method returned the whole response object instead of just response.text? (that way I would be able to get response codes, for example)
That being said, my objective is to retry the method when it fails.
Thanks!
Yes, I agree that this method shall return full response, but that change will be not backward compatible and may break somebody's code. Perhaps adding a parameter to this function that tells it to return full response is the only way to go here.
I am happy to accept pull request for this change.