incubator-ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Onischuk (JIRA)" <j...@apache.org>
Subject [jira] [Created] (AMBARI-3244) Ambari Client impove errors handling
Date Mon, 16 Sep 2013 10:11:54 GMT
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

Mime
View raw message