-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
If you get the password or username wrong then JIRA will give you a 401 Unauthorized response, but jipdate doesn't handle it very gracefully:
$ ./jipdate.py -t -u peter.maydell -q -f /tmp/status.txt
Username (john.doe@foo.org): peter.maydell
Username not found in config.yml, want to store it? (y/n) n
Password:
WARNING:root:Got recoverable error from GET https://dev-projects.linaro.org/rest/api/2/serverInfo, will retry [1/3] in 19.6700271926s. Err: 401
WARNING:root:Got recoverable error from GET https://dev-projects.linaro.org/rest/api/2/serverInfo, will retry [2/3] in 33.6201041765s. Err: 401
WARNING:root:Got recoverable error from GET https://dev-projects.linaro.org/rest/api/2/serverInfo, will retry [3/3] in 53.8470725899s. Err: 401
Traceback (most recent call last):
File "./jipdate.py", line 602, in <module>
main(sys.argv)
File "./jipdate.py", line 575, in main
jira, username = get_jira_instance(g_args.t)
File "./jipdate.py", line 445, in get_jira_instance
return (JIRA(g_server, basic_auth=credentials), username)
File "/home/petmay01/.local/lib/python2.7/site-packages/jira/client.py", line 317, in __init__
si = self.server_info()
File "/home/petmay01/.local/lib/python2.7/site-packages/jira/client.py", line 1771, in server_info
j = self._get_json('serverInfo')
File "/home/petmay01/.local/lib/python2.7/site-packages/jira/client.py", line 2172, in _get_json
r = self._session.get(url, params=params)
File "/home/petmay01/.local/lib/python2.7/site-packages/jira/resilientsession.py", line 150, in get
return self.__verb('GET', url, **kwargs)
File "/home/petmay01/.local/lib/python2.7/site-packages/jira/resilientsession.py", line 146, in __verb
raise_on_error(response, verb=verb, **kwargs)
File "/home/petmay01/.local/lib/python2.7/site-packages/jira/resilientsession.py", line 56, in raise_on_error
r.status_code, error, r.url, request=request, response=r, **kwargs)
jira.exceptions.JIRAError: JiraError HTTP 401 url: https://dev-projects.linaro.org/rest/api/2/serverInfo
text:
<html>
<head>
<title>Unauthorized (401)</title>
...followed by pages and pages of raw HTML/Javascript.
It would be nice to recognize this error code and give the user a helpful error message like "Username or password not recognized".
Metadata
Metadata
Assignees
Labels
No labels