diff options
Diffstat (limited to 'services/api/api_jenkins.py')
-rw-r--r-- | services/api/api_jenkins.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/services/api/api_jenkins.py b/services/api/api_jenkins.py index b63cb66..0b57b00 100644 --- a/services/api/api_jenkins.py +++ b/services/api/api_jenkins.py @@ -40,10 +40,10 @@ from django.conf import settings from requests.auth import HTTPBasicAuth from services.constants import Constants from services.helper import Helper +from services.session import session import logging import requests import time -from services.session import session logger = logging.getLogger('ice-ci.logger') @@ -60,7 +60,8 @@ class APIJenkins: try: r1 = requests.get(getURL, auth=HTTPBasicAuth( settings.JENKINS_USERNAME, settings.JENKINS_PASSWORD)) - while r1.status_code != 200 and counter <= Constants.GitLabConstants.RETRIES_NUMBER: + while r1.status_code != 200 and counter <= \ + Constants.GitLabConstants.RETRIES_NUMBER: r1 = requests.get(getURL, auth=HTTPBasicAuth( settings.JENKINS_USERNAME, settings.JENKINS_PASSWORD)) time.sleep(session.wait_until_time_pause) @@ -69,14 +70,15 @@ class APIJenkins: counter += 1 Helper.internal_assert(r1.status_code, 200) logger.debug("Job was created on APIJenkins!") - except: + except BaseException: msg = None if r1 is None: msg = "APIJenkins didn't create job for %s" % job_name else: - msg = "APIJenkins didn't create job for %s, see response >>> %s %s" % ( - job_name, r1.status_code, r1.reason) + msg = "APIJenkins didn't create job for %s, " +\ + "see response >>> %s %s" % ( + job_name, r1.status_code, r1.reason) logger.error(msg) raise Exception(msg) @@ -85,6 +87,7 @@ class APIJenkins: def find_build_num_out_of_jenkins_log(log): lines_array = log.splitlines() for line in lines_array: - if Constants.Dashboard.Checklist.JenkinsLog.Modal.Body.BUILD_IDENTIFIER in line: + if Constants.Dashboard.Checklist.JenkinsLog.\ + Modal.Body.BUILD_IDENTIFIER in line: parts = line.partition('jenkins') return parts[2] |