deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject git commit: DTACLOUD-402 Add operations for pseudo collections
Date Fri, 11 Jan 2013 13:51:09 GMT
Updated Branches:
  refs/heads/master 4092ec338 -> caa8285cb


DTACLOUD-402 Add operations for pseudo collections


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/caa8285c
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/caa8285c
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/caa8285c

Branch: refs/heads/master
Commit: caa8285cb3e5e46f2a54251f2b1948f185f60e9c
Parents: 4092ec3
Author: Joe VLcek <jvlcek@redhat.com>
Authored: Thu Jan 10 14:58:28 2013 -0500
Committer: marios <marios@redhat.com>
Committed: Fri Jan 11 15:48:10 2013 +0200

----------------------------------------------------------------------
 server/lib/cimi/helpers/database_helper.rb |    8 ++++++++
 server/lib/cimi/models/collection.rb       |    4 +++-
 2 files changed, 11 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/caa8285c/server/lib/cimi/helpers/database_helper.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/helpers/database_helper.rb b/server/lib/cimi/helpers/database_helper.rb
index b581c7b..22d20ac 100644
--- a/server/lib/cimi/helpers/database_helper.rb
+++ b/server/lib/cimi/helpers/database_helper.rb
@@ -6,10 +6,18 @@ module Deltacloud
     module Database
       include Deltacloud::Helpers::Drivers
 
+      DATABASE_COLLECTIONS = [ "machine_template", "address_template",
+        "volume_configuration", "volume_template" ]
+
       def test_environment?
         Deltacloud.test_environment?
       end
 
+     def provides?(entity)
+       return true if DATABASE_COLLECTIONS.include? entity
+       return false
+     end
+
       def load_attributes_for(model)
         return {} if test_environment?
         entity = get_entity(model)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/caa8285c/server/lib/cimi/models/collection.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/collection.rb b/server/lib/cimi/models/collection.rb
index 1836449..0f2a89e 100644
--- a/server/lib/cimi/models/collection.rb
+++ b/server/lib/cimi/models/collection.rb
@@ -122,7 +122,9 @@ module CIMI::Model
         cimi_entity = collection_class.entry_name.to_s.singularize
         cimi_create = "create_#{cimi_entity}_url"
         dcloud_create = context.deltacloud_create_method_for(cimi_entity)
-        if context.respond_to?(cimi_create) && context.driver.respond_to?(dcloud_create)
+        if(context.respond_to?(cimi_create) &&
+           context.driver.respond_to?(dcloud_create)) ||
+             provides?(cimi_entity)
           url = context.send(cimi_create)
           ops << { :rel => "add", :href => url }
         end


Mime
View raw message