You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by "Mahadev konar (JIRA)" <ji...@apache.org> on 2013/09/17 22:07:57 UTC
[jira] [Reopened] (AMBARI-3244) Ambari Client improve errors
handling
[ https://issues.apache.org/jira/browse/AMBARI-3244?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mahadev konar reopened AMBARI-3244:
-----------------------------------
> Ambari Client improve errors handling
> -------------------------------------
>
> Key: AMBARI-3244
> URL: https://issues.apache.org/jira/browse/AMBARI-3244
> Project: Ambari
> Issue Type: Task
> Reporter: Andrew Onischuk
> Assignee: Andrew Onischuk
> Priority: Critical
> Fix For: 1.4.1
>
> Attachments: AMBARI-3244_2.patch, AMBARI-3244.patch
>
>
> 1. Add a server error response to the getters and creators
> From the user's side error handling look's like this:
> {code}
> try:
> // will fail somewhere during trying to create a host model with corrupt
> // response
> host = client.get_host('not existant host')
> except Exception, ex:
> print "Unknown termination reason!"
> return
> {code}
> Should be:
> {code}
> host, err_resp = client.get_host('not existant host')
> if err_resp:
> print "Error happened, terminating with error code" % (err_resp.status)
> print "Reason: %s" % (err_resp.message)
> return
> {code}
> 2. Some error messages are missed. The problem is that the way we decide, whether error response is decodable can't be based on the error code
> E.g. 404 can be json as well as html
> {code}
> component = client.get_components('HDP-1.0.0', 'JOBTRACKER')
> {code}
> {code}
> {
> "status" : 404,
> "message" : "The requested resource doesn't exist: Stack data, stackName=HDP, stackVersion=HDP-1.0.0"
> }
> {code}
> 3. Encapsulate from user messing with return codes, to find out if everything was fine
> Is
> {code}
> resp = cluster.delete_host('bad_host')
>
> if resp.status != 200 and resp.status != 201:
> print "Terminating on error"
> return
> {code}
> Should be:
> {code}
> resp = cluster.delete_host('bad_host')
>
> if resp.is_error():
> print "Terminating on error"
> return
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira