deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Lutterkort (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DTACLOUD-525) Unable to perform operations on CIMI::Model
Date Thu, 04 Apr 2013 18:25:25 GMT

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

David Lutterkort commented on DTACLOUD-525:
-------------------------------------------

The problem is that System.find returns a model; it should return a CIMI::Service::System
- if 'sys' is a CIMI::Model::System, just do CIMI::Service::System.new(:model => sys)

                
> Unable to perform operations on CIMI::Model
> -------------------------------------------
>
>                 Key: DTACLOUD-525
>                 URL: https://issues.apache.org/jira/browse/DTACLOUD-525
>             Project: DeltaCloud
>          Issue Type: Bug
>            Reporter: Michal Fojtik
>            Assignee: David Lutterkort
>            Priority: Blocker
>
> Today Dies found an interesting issue in CIMI::Model vs CIMI::Service:
> mock_driver_cimi_methods.rb:
>     def systems(credentials, opts={})
>       check_credentials(credentials)
>       if opts[:id].nil?
>         systems = @client.load_all_cimi(:system).map{|sys| CIMI::Model::System.from_json(sys)}
>       else
>         begin
>           systems = [CIMI::Model::System.from_json(@client.load_cimi(:system, opts[:id]))]
>         rescue Errno::ENOENT
>           return []
>         end
>       end
>       systems.map{|sys| convert_urls(sys, opts[:env])}.flatten
>     end
> As you can see, this method will return CIMI::Model::System, which is fine if you want
to serialize it directly to JSON/XML. However, this is how we define 'stop' operation in Rabbit:
>       action :stop, :with_capability => :stop_system do
>         description "Stop specific system."
>         param :id,          :string,    :required
>         control do
>           system = System.find(params[:id], self)
>           action = Action.parse(self)
>           system.perform(action, self) do |operation|
>             no_content_with_status(202) if operation.success?
>             # Handle errors using operation.failure?
>           end
>         end
>       end
> In this case, "system.perform" will fail with:
> undefined method `perform' for #<CIMI::Model::System:0x00000003d154b8>
> The .perform() method is defined for CIMI::Service::System. Any clues how to fix this?

--
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