You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by "Andrew Onischuk (JIRA)" <ji...@apache.org> on 2013/09/16 12:11:54 UTC
[jira] [Created] (AMBARI-3244) Ambari Client impove errors handling
Andrew Onischuk created AMBARI-3244:
---------------------------------------
Summary: Ambari Client impove 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
1. Add a server error response to the getters and creators
Is:
{code}
try:
// will fail somewhere during trying to create a host model with corrupt
// response
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