Hi Michal,

David helped me pinpoint where the issue was, and suggested I ask you why the 
capability check is failing:

On my machine, the following request causes a "The required capability to 
execute this operation is missing", while it works on David's:
curl --user mockuser:mockpassword -H "Accept: application/xml" 
"http://localhost:3001/cimi/systems/system1";

I get the same error on CentOS 6.3.
When I make the following change in systems.rb, it works for me too:

-    set :capability, lambda { |m| driver.respond_to? m }
+#    set :capability, lambda { |m| driver.respond_to? m }
+    set :capability, lambda { |t| true }

David asked me to add debugging puts to systems.rb's show operation to confirm 
the driver and systems method existence, but that looked normal:

[11:15] <lutter> in the show operation for systems, can you stick a 'puts 
"Driver: #{driver.class.name}"'
[11:17] <lutter> oh .. and 'puts "Driver: #{driver.class.name} 
#{driver.respond_to? :systems}"'
[11:18] <dkoper> Driver: Deltacloud::Drivers::Mock::MockDriver true

I'm running on ruby 1.8.7, if that matters.

> What's missing from your patches though are unit tests ...

I've just sent a new patch with unit tests. Please review and ACK :)

Regards,
Dies Koper


> -----Original Message-----
> From: David Lutterkort [mailto:lut...@redhat.com]
> Sent: Tuesday, 19 February 2013 10:02 AM
> To: dev@deltacloud.apache.org
> Subject: Re: [PATCH] CIMI: system and system_template support for mock
> driver. Just GET for now, no subcollections
> 
> Hi Dies,
> 
> strange, both of these work for me now. I had to do an unholy
> combination of deleting directories of the form /var/tmp/*deltacloud* ,
> restarting the server and requesting the CEP to get proper responses;
> with the two patches I just posted, it should be enough to do 'rake
> mock:fixtures:reset'
> 
> After that, though, I get proper responses:
> 
>         # curl --user mockuser:mockpassword -H 'Accept:
> application/xml'
> "http://localhost:3001/cimi/system_templates/template1";
> 
>         <SystemTemplate xmlns="http://schemas.dmtf.org/cimi/1";
> resourceURI="http://schemas.dmtf.org/cimi/1/SystemTemplate";>
> 
> <id>http://localhost:3001/cimi/system_templates/template1</id>
>           <name>template1</name>
>           <description>A mock system template</description>
>           <created>Fri Feb 08 12:15:15 EET 2013</created>
>           <componentDescriptor>
>             <name>my machine</name>
>             <description>an inline mock machine template</description>
>             <type>http://schemas.dmtf.org/cimi/1/Machine</type>
>           </componentDescriptor>
>           <componentDescriptor>
>             <name>my network</name>
>             <description>a reference to an existing mock network
> template</description>
>             <type>http://schemas.dmtf.org/cimi/1/Network</type>
>           </componentDescriptor>
>           <operation rel="edit"
> href="http://localhost:3001/cimi/system_templates/template1"; />
>           <operation rel="delete"
> href="http://localhost:3001/cimi/system_templates/template1"; />
>         </SystemTemplate>
> 
>         # curl --user mockuser:mockpassword -H 'Accept:
> application/xml' "http://localhost:3001/cimi/systems/system1";
> 
>         <System xmlns="http://schemas.dmtf.org/cimi/1";
> resourceURI="http://schemas.dmtf.org/cimi/1/System";>
>           <id>http://localhost:3001/cimi/systems/system1</id>
>           <name>system1</name>
>           <description>the first system</description>
>           <created>Fri Feb 08 15:25:41 EET 2013</created>
>           <state>STOPPED</state>
>           <operation rel="edit"
> href="http://localhost:3001/cimi/systems/system1"; />
>           <operation rel="delete"
> href="http://localhost:3001/cimi/systems/system1"; />
>         </System>
> 
> What's missing from your patches though are unit tests ...
> 
> David
> 
> 

Reply via email to