diff options
author | Arthur She <arthur.she@linaro.org> | 2015-10-21 18:58:14 -0700 |
---|---|---|
committer | Arthur She <arthur.she@linaro.org> | 2015-10-21 18:58:14 -0700 |
commit | df9f3409c1f233948f73a504d7d26f70d9b2ab53 (patch) | |
tree | 0b96fd6fdc242726b6cf3c37c18ffaad55ff3483 | |
parent | 329aa6129426668ddb7c14e7e495a727f184b6b3 (diff) |
Error handling for .netrc
modified: report_automation.py
-rwxr-xr-x | report_automation.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/report_automation.py b/report_automation.py index e8b2cb7..dedce1d 100755 --- a/report_automation.py +++ b/report_automation.py @@ -61,7 +61,7 @@ class LAVA(object): server_url = "https://%s:%s@%sRPC2/" % (self.username, self.token, self.lava_server.split("//")[1]) self.server = xmlrpclib.ServerProxy(server_url) except: - logger.error("Can not connect to LAVA server: %s" % lava_server) + logger.exception("Can not connect to LAVA server: %s" % lava_server) exit(-1) def get_job_info(self, job_no): @@ -287,24 +287,28 @@ e.g. machine validation.linaro.org login USERNAME password AUTHENTICATION TOKEN""") + parser.add_argument("-bn", "--build-no", dest="build_no", type=int, required=True, + help="Specify the Jenkins build number. This is MANDATORY.") parser.add_argument("-u", "--jenkins-url", dest="jenkins_url", default=JENKINS_URL, - help="Specify the Jenkins URL. Default: %s" % JENKINS_URL) + help="Specify the Jenkins URL. This is optional.\nDefault: %s" % JENKINS_URL) parser.add_argument("-job", "--jenkins-job-name", dest="jenkins_job_name", default=JENKINS_JOB, - help="Specify the Jenkins job name. Default: %s" % JENKINS_JOB) - parser.add_argument("-bn", "--build-no", dest="build_no", type=int, required=True, - help="Specify the Jenkins build number") + help="Specify the Jenkins job name.This is optional.\nDefault: %s" % JENKINS_JOB) parser.add_argument("-a", "--manual-lava-jobs", dest="manual_lava_jobs", nargs = '+', - help="Specify the test jobs that were submitted manually") + help="Specify the test jobs that were submitted manually. This is optional.") parser.add_argument("-d", "--exclude-lava-jobs", dest="exclude_lava_jobs", nargs = '+', - help="Specify the test jobs that don't want to be included in the report") + help="Specify the test jobs that don't want to be included in the report. This is optional.") parser.add_argument("-temp", "--template", dest="template_file", default=REPORT_TEMPLATE, - help="Specify the report template. Default: %s" % REPORT_TEMPLATE) + help="Specify the report template. This is optional.\nDefault: %s" % REPORT_TEMPLATE) parser.add_argument("-o", "--output", dest="output_file", default=REPORT_OUTPUT, - help="Specify the output file name. Default: %s" % REPORT_OUTPUT) + help="Specify the output file name. This is optional.\nDefault: %s" % REPORT_OUTPUT) args = parser.parse_args() - lava_login_info = netrc.netrc().authenticators("validation.linaro.org") + try: + lava_login_info = netrc.netrc().authenticators("validation.linaro.org") + except: + logger.error("Can not get authentication credential for LAVA Server from ~/.netrc") + exit(-1) if lava_login_info is None: logger.error("Can not get authentication credential for LAVA Server from ~/.netrc") exit(-1) |