You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by David Lutterkort <lu...@redhat.com> on 2012/10/01 05:38:28 UTC

Re: NoMethodError - undefined method `underscore' for CIMI::Model::ResourceMetadata:Class

My bad .. I broke that with c6b642b0; CIMI::Model::root_entities is now
an array of classes, rather than an array of names. To get the old
array, you'll need to do something like

  CIMI::Model::root_entites.map do |klass|
    klass.name.split('::').last.pluralize.underscore
  end

Unfortunately, this week looks pretty bad for me to come up with a
proper fix; but if somebody else could cook up a patch, it would be much
appreciated.

David

On Sat, 2012-09-29 at 18:02 +1000, Koper, Dies wrote:
> ruby bin\start -u http://localhost:3001/cimi
> 
> then access http://localhost:4001/cimi/cloudEntryPoint
> gives me:
> 
> NoMethodError - undefined method `underscore' for
> CIMI::Model::ResourceMetadata:Class:
>         bin/../lib/entities/cloud_entry_point.rb:21:in `GET
> /cimi/cloudEntryPoint'
>         bin/../lib/entities/cloud_entry_point.rb:21:in `map'
> 
> Why?
> 
> Server was started with ruby bin\deltacloudd -i fgcp -f cimi
> And seems to have handled the request successfully:
> 
> 127.0.0.1 - - [29/Sep/2012 17:55:01] "GET /cimi/cloudEntryPoint
> HTTP/1.1" 200 861 0.0090
> 
> This is on Windows 7 with ruby 1.8.7 (2012-02-08 patchlevel 358)
> [i386-mingw32]
> And I ran bundle in the server and cimi client directories before
> running the commands.
> 
> Cimi client:
> 
> Gems included by the bundle:
>   * bundler (1.0.22)
>   * haml (3.1.7)
>   * json (1.7.5)
>   * mime-types (1.19)
>   * nokogiri (1.5.5)
>   * rack (1.4.1)
>   * rack-accept (0.4.5)
>   * rack-protection (1.2.0)
>   * rest-client (1.6.7)
>   * sinatra (1.3.3)
>   * sinatra-content-for (0.1)
>   * tilt (1.3.3)
> 
> Server:
> 
> Gems included by the bundle:
>   * addressable (2.3.2)
>   * akami (1.2.0)
>   * aws (2.5.7)
>   * builder (3.1.3)
>   * bundler (1.0.22)
>   * cloudfiles (1.5.0.1)
>   * cloudservers (0.4.2)
>   * crack (0.3.1)
>   * daemons (1.1.9)
>   * deltacloud-core (1.0.3)
>   * eventmachine (1.0.0)
>   * excon (0.16.4)
>   * fog (1.6.0)
>   * formatador (0.2.3)
>   * gyoku (0.4.6)
>   * haml (3.1.7)
>   * http_connection (1.4.1)
>   * httpi (1.1.1)
>   * jruby-pageant (1.1.1)
>   * json (1.7.5)
>   * mime-types (1.19)
>   * minitest (4.0.0)
>   * multi_json (1.3.6)
>   * net-scp (1.0.4)
>   * net-ssh (2.6.0)
>   * nokogiri (1.5.5)
>   * nori (1.1.3)
>   * openstack (1.0.6)
>   * rack (1.4.1)
>   * rack-accept (0.4.5)
>   * rack-protection (1.2.0)
>   * rack-test (0.6.2)
>   * rake (0.9.2.2)
>   * rbovirt (0.0.12)
>   * rbvmomi (1.6.0)
>   * require_relative (1.0.3)
>   * rest-client (1.6.7)
>   * ruby-hmac (0.4.0)
>   * savon (1.2.0)
>   * simplecov (0.6.4)
>   * simplecov-html (0.5.3)
>   * sinatra (1.3.3)
>   * sinatra-rabbit (1.1.2)
>   * thin (1.5.0)
>   * tilt (1.3.3)
>   * trollop (2.0)
>   * uuidtools (2.1.3)
>   * vcr (2.2.5)
>   * wasabi (2.5.1)
>   * waz-storage (1.1.4)
>   * webmock (1.8.11)
>   * xml-simple (1.1.1)
> 
> Cheers,
> Dies Koper
> 
> 




Re: NoMethodError - undefined method `underscore' for CIMI::Model::ResourceMetadata:Class

Posted by Michal Fojtik <mf...@redhat.com>.
On Oct 1, 2012, at 5:38 AM, David Lutterkort <lu...@redhat.com> wrote:

The patch is easy:

==== SNIP =====

diff --git a/clients/cimi/lib/entities/cloud_entry_point.rb b/clients/cimi/lib/entities/cloud_entry_point.rb
index 94225f7..b8fa448 100644
--- a/clients/cimi/lib/entities/cloud_entry_point.rb
+++ b/clients/cimi/lib/entities/cloud_entry_point.rb
@@ -18,7 +18,9 @@ class CIMI::Frontend::CloudEntryPoint < CIMI::Frontend::Entity
   get '/cimi/cloudEntryPoint' do
     entry_point_xml = get_entity_collection('cloudEntryPoint', credentials)
     @entry_point = CIMI::Model::CloudEntryPoint.from_xml(entry_point_xml)
-    @entities = CIMI::Model::root_entities.map { |e| e.underscore.downcase }.reject{|col| @entry_point[col].hr
+    @entities = CIMI::Model::root_entities.map do |e|
+      e.name.split('::').last.pluralize.underscore.downcase
+    end.reject{|col| @entry_point[col].href.nil?}
     haml :'cloud_entry_point/index'
   end

==== SNIP =====


Unfortunately the CIMI client is now pretty broken because we're implementing
more CIMI entities and making the CIMI frontend compatible with v1.0.

So if you apply this patch, then you will get another error... I think David is
now working on fixing this, so hopefully we will have proper patch for the client
soon.

> My bad .. I broke that with c6b642b0; CIMI::Model::root_entities is now
> an array of classes, rather than an array of names. To get the old
> array, you'll need to do something like
> 
>  CIMI::Model::root_entites.map do |klass|
>    klass.name.split('::').last.pluralize.underscore
>  end
> 
> Unfortunately, this week looks pretty bad for me to come up with a
> proper fix; but if somebody else could cook up a patch, it would be much
> appreciated.
> 
> David
> 
> On Sat, 2012-09-29 at 18:02 +1000, Koper, Dies wrote:
>> ruby bin\start -u http://localhost:3001/cimi
>> 
>> then access http://localhost:4001/cimi/cloudEntryPoint
>> gives me:
>> 
>> NoMethodError - undefined method `underscore' for
>> CIMI::Model::ResourceMetadata:Class:
>>        bin/../lib/entities/cloud_entry_point.rb:21:in `GET
>> /cimi/cloudEntryPoint'
>>        bin/../lib/entities/cloud_entry_point.rb:21:in `map'
>> 
>> Why?
>> 
>> Server was started with ruby bin\deltacloudd -i fgcp -f cimi
>> And seems to have handled the request successfully:
>> 
>> 127.0.0.1 - - [29/Sep/2012 17:55:01] "GET /cimi/cloudEntryPoint
>> HTTP/1.1" 200 861 0.0090
>> 
>> This is on Windows 7 with ruby 1.8.7 (2012-02-08 patchlevel 358)
>> [i386-mingw32]
>> And I ran bundle in the server and cimi client directories before
>> running the commands.
>> 
>> Cimi client:
>> 
>> Gems included by the bundle:
>>  * bundler (1.0.22)
>>  * haml (3.1.7)
>>  * json (1.7.5)
>>  * mime-types (1.19)
>>  * nokogiri (1.5.5)
>>  * rack (1.4.1)
>>  * rack-accept (0.4.5)
>>  * rack-protection (1.2.0)
>>  * rest-client (1.6.7)
>>  * sinatra (1.3.3)
>>  * sinatra-content-for (0.1)
>>  * tilt (1.3.3)
>> 
>> Server:
>> 
>> Gems included by the bundle:
>>  * addressable (2.3.2)
>>  * akami (1.2.0)
>>  * aws (2.5.7)
>>  * builder (3.1.3)
>>  * bundler (1.0.22)
>>  * cloudfiles (1.5.0.1)
>>  * cloudservers (0.4.2)
>>  * crack (0.3.1)
>>  * daemons (1.1.9)
>>  * deltacloud-core (1.0.3)
>>  * eventmachine (1.0.0)
>>  * excon (0.16.4)
>>  * fog (1.6.0)
>>  * formatador (0.2.3)
>>  * gyoku (0.4.6)
>>  * haml (3.1.7)
>>  * http_connection (1.4.1)
>>  * httpi (1.1.1)
>>  * jruby-pageant (1.1.1)
>>  * json (1.7.5)
>>  * mime-types (1.19)
>>  * minitest (4.0.0)
>>  * multi_json (1.3.6)
>>  * net-scp (1.0.4)
>>  * net-ssh (2.6.0)
>>  * nokogiri (1.5.5)
>>  * nori (1.1.3)
>>  * openstack (1.0.6)
>>  * rack (1.4.1)
>>  * rack-accept (0.4.5)
>>  * rack-protection (1.2.0)
>>  * rack-test (0.6.2)
>>  * rake (0.9.2.2)
>>  * rbovirt (0.0.12)
>>  * rbvmomi (1.6.0)
>>  * require_relative (1.0.3)
>>  * rest-client (1.6.7)
>>  * ruby-hmac (0.4.0)
>>  * savon (1.2.0)
>>  * simplecov (0.6.4)
>>  * simplecov-html (0.5.3)
>>  * sinatra (1.3.3)
>>  * sinatra-rabbit (1.1.2)
>>  * thin (1.5.0)
>>  * tilt (1.3.3)
>>  * trollop (2.0)
>>  * uuidtools (2.1.3)
>>  * vcr (2.2.5)
>>  * wasabi (2.5.1)
>>  * waz-storage (1.1.4)
>>  * webmock (1.8.11)
>>  * xml-simple (1.1.1)
>> 
>> Cheers,
>> Dies Koper
>> 
>> 
> 
> 
> 

Michal Fojtik
http://deltacloud.org
mfojtik@redhat.com