deltacloud-dev mailing list archives

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

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

Dies Koper commented on DTACLOUD-525:
-------------------------------------

I'm returning CIMI::Model objects from my driver as I'm populating the model. System.find
just calls the driver method.
Are you saying we need to change all find methods to iterate through the collections returned
by the drivers to do that version?
Where's the best place?
                
> 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