Add 1 minute retry for Jenkins.job_info
The tcp-qa requests the build_info when it's not ready
Change-Id: I7136d49063f6c311950060f5cb8e08770bd49acc
Related-Prod:#PROD-35054
diff --git a/tcp_tests/managers/jenkins/client.py b/tcp_tests/managers/jenkins/client.py
index b9f6a02..0fdff80 100644
--- a/tcp_tests/managers/jenkins/client.py
+++ b/tcp_tests/managers/jenkins/client.py
@@ -59,7 +59,17 @@
return filter(lambda x: name in x['fullname'], self.jobs())
def job_info(self, name):
- return self.__client.get_job_info(name)
+ max_count = 6
+ for count in range(max_count):
+ try:
+ return self.__client.get_job_info(name)
+ except jenkins.JenkinsException as err:
+ print("caught JenkinsException: {err}. \
+ repeat {count}/{max_count}".
+ format(err=err,
+ count=count,
+ max_count=max_count))
+ time.sleep(10)
def list_builds(self, name):
return self.job_info(name).get('builds')