From: Joe VLcek <[email protected]>
---
server/lib/cimi/helpers/database_helper.rb | 8 ++++++++
server/lib/cimi/models/collection.rb | 4 +++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/server/lib/cimi/helpers/database_helper.rb
b/server/lib/cimi/helpers/database_helper.rb
index b581c7b..9c203aa 100644
--- a/server/lib/cimi/helpers/database_helper.rb
+++ b/server/lib/cimi/helpers/database_helper.rb
@@ -10,6 +10,14 @@ module Deltacloud
Deltacloud.test_environment?
end
+ def pseudo_collection?(model)
+ # Could add all pseudo collections here
+ # Or better seed the db with templates for supported
+ # pseudo collections and match against the DB here.
+ return true if model == "create_machine_template"
+ return false
+ end
+
def load_attributes_for(model)
return {} if test_environment?
entity = get_entity(model)
diff --git a/server/lib/cimi/models/collection.rb
b/server/lib/cimi/models/collection.rb
index 0587264..4b422d1 100644
--- a/server/lib/cimi/models/collection.rb
+++ b/server/lib/cimi/models/collection.rb
@@ -121,7 +121,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)) ||
+ pseudo_collection?(dcloud_create)
url = context.send(cimi_create)
ops << { :rel => "add", :href => url }
end
--
1.7.11.7