[ 
https://issues.apache.org/jira/browse/DTACLOUD-127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13202242#comment-13202242
 ] 

Michal Fojtik commented on DTACLOUD-127:
----------------------------------------

Hi Martyn,

The valid_credentials? method in client is implemented in this way: 
https://gist.github.com/1759182

As you can see, this method will return 'true' *only* if the response given 
from the server is 200 (OK).
In all other cases client, should handle the errors returned from the client 
using 'handle_backend_error(response)'
method in the 'request()' method. This should handle this range of errors: 
[500, 502, 501, 401]

The 'handle_backend_error' method (https://gist.github.com/1759195) will try to 
read the exception message, return code
and the backtrace (if available) and then 'throw' this exception on client 
side. As result the client should get the original
'server' exception (including the original backtrace from the server). The 
'BackendError' exception message should include
the HTTP error code returned from the server.

So I think this is *all* we can do in client to handle server errors.

Now, on the server side, there was an update last week where I tried to return 
an backtrace for the 50x errors. This backtrace
should be now included in XML returned from the server (and caught by client 
(see above)).

Nwo back to the original problem of handling the 'valid_credentials?' method. 
The recent update (http://tinyurl.com/8yl2orp
) to DC should handle this quite well:

client.driver('ec2').valid_provider? 'ap-southeast-1'
client.driver('rhevm').valid_provider_url? 
'https://rhevm.host.com:8443/rhevm-api;645e425e-66fe-4ac9-8874-537bd10ef08d'

-> This should validate given provider

The problem with valid_credentials? Francesco was patching, was that in 
Deltacloud API the valid_credentials? method was
wrapped by 'begin...rescue...end' which does not involve our exception DSL in 
capturing the eventual exceptions and instead
of throwing an error the driver just return 'false' (no exception was raised to 
client). What Francesco did is that now the
exception is being raised to the client in case that something went wrong (like 
the original problem you reported).

You are right that we need to also update RHEV-M and Vsphere drivers to do the 
same. I'll send patches for that momentary.


                
> Add better error handling on valid_credentials? request
> -------------------------------------------------------
>
>                 Key: DTACLOUD-127
>                 URL: https://issues.apache.org/jira/browse/DTACLOUD-127
>             Project: DeltaCloud
>          Issue Type: Improvement
>          Components: Server
>            Reporter: Martyn Taylor
>            Assignee: Michal Fojtik
>
> In order to determine why a particular valid_credentials? request (using the 
> ruby client) has failed.  There should be sufficient error/exceptions.  
> Example:
> thin server (localhost:3002) [deltacloud-mock][22098]:
> Aws::AwsError:ec2-eu-west-1 temporarily unavailable: (getaddrinfo: Name or 
> service not known)
> This causes failure of the valid_credentials? method but offers no more 
> information.
> This is related to this BZ in aeolus-conductor: 
> https://bugzilla.redhat.com/show_bug.cgi?id=753880

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to