deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH 4/4] Add CIMI::EntityMetadata to cloud entry point
Date Mon, 05 Dec 2011 16:15:17 GMT
From: marios <marios@redhat.com>


Signed-off-by: marios <marios@redhat.com>
---
 server/lib/cimi/model/cloud_entry_point.rb |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/server/lib/cimi/model/cloud_entry_point.rb b/server/lib/cimi/model/cloud_entry_point.rb
index 62a91b6..83c82c6 100644
--- a/server/lib/cimi/model/cloud_entry_point.rb
+++ b/server/lib/cimi/model/cloud_entry_point.rb
@@ -16,17 +16,24 @@
 class CIMI::Model::CloudEntryPoint < CIMI::Model::Base
 
   def self.create(context)
+    entity_metadata = []
     root_entities = CIMI::Model.root_entities.inject({}) do |result, entity|
       if context.respond_to? :"#{entity.underscore}_url"
         result[entity.underscore] = { :href => context.send(:"#{entity.underscore}_url")
}
       end
+      entity_class = Object::const_get("CIMI").const_get("Model").const_get("#{entity.singularize.upcase_first}")
+      entity_metadata << entity_class.create_entity_metadata(context) if entity_class.respond_to?("create_entity_metadata")
       result
     end
+    root_entity_meta = [] ; entity_metadata.each do |m|
+      root_entity_meta << { :href=> m.uri}
+    end
     root_entities.merge!({
       :name => context.driver.name,
       :description => "Cloud Entry Point for the Deltacloud #{context.driver.name} driver",
       :uri => context.cloudEntryPoint_url,
-      :created => Time.now
+      :created => Time.now,
+      "entity_metadata" => root_entity_meta
     })
     self.new(root_entities)
   end
-- 
1.7.6.4


Mime
View raw message