incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michal Fojtik (Commented) (JIRA)" <>
Subject [jira] [Commented] (DTACLOUD-89) deltacloud-client should throw an exception if an action fails
Date Mon, 10 Oct 2011 12:11:30 GMT


Michal Fojtik commented on DTACLOUD-89:

Currently the methods for managing state of the instance are meta-programatically created
using the <actions/> XML block fetched from current instance. That means when you do
a 'start!' on already started instance our client will respond with:

    ./lib/base_object.rb:138:in `method_missing': undefined method `start!' for #<DeltaCloud::API::Stateful::Instance:0x10f293190>

Which IMHO is the correct way. Simply the method is not available (not exists) for current
instance of the Instance. To check if current instance support '.start!' operation (same for
stop!, reboot!, etc..) you can do following:

    instance.respond_to? :start!
Eventually you can call:


This should return following:

    [["stop", "http://localhost:3002/api/instances/ed84016a-a000-4007-adeb-cde73d0f58a6/stop"],
["create_image", "http://localhost:3002/api/images;instance_id=ed84016a-a000-4007-adeb-cde73d0f58a6"]]

But you raised a valid point. When the call return an error, currently we're capturing only
500, but this code is reserved for DC API only errrors. Backend errors are handled using 502
code (Backend Error). I'll send a fix to capture this errors.
> deltacloud-client should throw an exception if an action fails
> --------------------------------------------------------------
>                 Key: DTACLOUD-89
>                 URL:
>             Project: DeltaCloud
>          Issue Type: Bug
>          Components: Client (Ruby)
>         Environment: Fedora-15, rubygem-deltacloud-client-0.4.0-3.fc15.noarch
>            Reporter: Chris Lalancette
>            Assignee: Michal Fojtik
> Aeolus was running the following code:
>       dcloud_instance.send(action)
> (where action == :start!)
> However, the RHEV-M datacenter that this was being run against failed to start the instance.
 Not only did deltacloud-core fail to return a usable error message (,
but the deltacloud client also did not seem to throw an exception for this failure.  If the
call outright fails, the ruby-ish thing to do is probably to raise an exception and let the
user deal with it.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message