Michal Fojtik created DTACLOUD-525:
--------------------------------------
Summary: 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