You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2010/07/09 01:19:01 UTC
svn commit: r962043 - in /incubator/deltacloud/trunk/framework:
app/controllers/ app/models/ app/views/flavors/ app/views/images/
app/views/instances/ config/ lib/converters/ lib/deltacloud/
Author: lutter
Date: Thu Jul 8 23:19:00 2010
New Revision: 962043
URL: http://svn.apache.org/viewvc?rev=962043&view=rev
Log:
Fully change resource_id to id
Modified:
incubator/deltacloud/trunk/framework/app/controllers/instances_controller.rb
incubator/deltacloud/trunk/framework/app/models/base_model.rb
incubator/deltacloud/trunk/framework/app/models/flavor.rb
incubator/deltacloud/trunk/framework/app/models/image.rb
incubator/deltacloud/trunk/framework/app/models/instance.rb
incubator/deltacloud/trunk/framework/app/views/flavors/index.html.erb
incubator/deltacloud/trunk/framework/app/views/flavors/show.html.erb
incubator/deltacloud/trunk/framework/app/views/images/index.html.erb
incubator/deltacloud/trunk/framework/app/views/images/show.html.erb
incubator/deltacloud/trunk/framework/app/views/instances/index.html.erb
incubator/deltacloud/trunk/framework/app/views/instances/new.html.erb
incubator/deltacloud/trunk/framework/app/views/instances/show.html.erb
incubator/deltacloud/trunk/framework/config/environment.rb
incubator/deltacloud/trunk/framework/lib/converters/xml_converter.rb
incubator/deltacloud/trunk/framework/lib/deltacloud/base_driver.rb
Modified: incubator/deltacloud/trunk/framework/app/controllers/instances_controller.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/controllers/instances_controller.rb?rev=962043&r1=962042&r2=962043&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/controllers/instances_controller.rb (original)
+++ incubator/deltacloud/trunk/framework/app/controllers/instances_controller.rb Thu Jul 8 23:19:00 2010
@@ -60,13 +60,13 @@ class InstancesController < ApplicationC
} )
render :action=>:new and return
end
- instance = driver.create_instance( credentials, @image.resource_id, params[:flavor_id] )
- redirect_to instance_url( instance.resource_id )
+ instance = driver.create_instance( credentials, @image.id, params[:flavor_id] )
+ redirect_to instance_url( instance.id )
}
format.xml {
- instance = driver.create_instance( credentials, @image.resource_id, params[:flavor_id] )
+ instance = driver.create_instance( credentials, @image.id, params[:flavor_id] )
puts "RESULT #{instance.inspect}"
- render :xml=>convert_to_xml( :instance, instance), :status=>:created, :location=>instance_url( instance.resource_id )
+ render :xml=>convert_to_xml( :instance, instance), :status=>:created, :location=>instance_url( instance.id )
}
end
end
Modified: incubator/deltacloud/trunk/framework/app/models/base_model.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/models/base_model.rb?rev=962043&r1=962042&r2=962043&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/models/base_model.rb (original)
+++ incubator/deltacloud/trunk/framework/app/models/base_model.rb Thu Jul 8 23:19:00 2010
@@ -1,11 +1,17 @@
class BaseModel
+
def initialize(init=nil)
if ( init )
- self.resource_id=init[:id]
+ @id=init[:id]
init.each{|k,v|
self.send( "#{k}=", v ) if ( self.respond_to?( "#{k}=" ) )
}
end
end
+
+ def id
+ @id
+ end
+
end
Modified: incubator/deltacloud/trunk/framework/app/models/flavor.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/models/flavor.rb?rev=962043&r1=962042&r2=962043&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/models/flavor.rb (original)
+++ incubator/deltacloud/trunk/framework/app/models/flavor.rb Thu Jul 8 23:19:00 2010
@@ -1,7 +1,8 @@
class Flavor < BaseModel
- attr_accessor :resource_id
+
attr_accessor :architecture
attr_accessor :memory
attr_accessor :storage
+
end
Modified: incubator/deltacloud/trunk/framework/app/models/image.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/models/image.rb?rev=962043&r1=962042&r2=962043&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/models/image.rb (original)
+++ incubator/deltacloud/trunk/framework/app/models/image.rb Thu Jul 8 23:19:00 2010
@@ -1,7 +1,8 @@
class Image < BaseModel
- attr_accessor :resource_id
+
attr_accessor :owner_id
attr_accessor :description
attr_accessor :architecture
+
end
Modified: incubator/deltacloud/trunk/framework/app/models/instance.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/models/instance.rb?rev=962043&r1=962042&r2=962043&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/models/instance.rb (original)
+++ incubator/deltacloud/trunk/framework/app/models/instance.rb Thu Jul 8 23:19:00 2010
@@ -1,7 +1,6 @@
class Instance < BaseModel
- attr_accessor :resource_id
attr_accessor :owner_id
attr_accessor :image_id
attr_accessor :flavor_id
Modified: incubator/deltacloud/trunk/framework/app/views/flavors/index.html.erb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/views/flavors/index.html.erb?rev=962043&r1=962042&r2=962043&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/views/flavors/index.html.erb (original)
+++ incubator/deltacloud/trunk/framework/app/views/flavors/index.html.erb Thu Jul 8 23:19:00 2010
@@ -19,7 +19,7 @@
<% for flavor in @flavors %>
<tr>
<td>
- <%= link_to flavor.resource_id, flavor_url( flavor.resource_id ) %>
+ <%= link_to flavor.id, flavor_url( flavor.id ) %>
</td>
<td>
<%= flavor.architecture %>
Modified: incubator/deltacloud/trunk/framework/app/views/flavors/show.html.erb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/views/flavors/show.html.erb?rev=962043&r1=962042&r2=962043&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/views/flavors/show.html.erb (original)
+++ incubator/deltacloud/trunk/framework/app/views/flavors/show.html.erb Thu Jul 8 23:19:00 2010
@@ -1,4 +1,4 @@
-<h1><%= @flavor.resource_id %></h1>
+<h1><%= @flavor.id %></h1>
<dl>
<di>
Modified: incubator/deltacloud/trunk/framework/app/views/images/index.html.erb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/views/images/index.html.erb?rev=962043&r1=962042&r2=962043&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/views/images/index.html.erb (original)
+++ incubator/deltacloud/trunk/framework/app/views/images/index.html.erb Thu Jul 8 23:19:00 2010
@@ -19,7 +19,7 @@
<% for image in @images %>
<tr>
<td>
- <%= link_to image.resource_id, image_url( image.resource_id ) %>
+ <%= link_to image.id, image_url( image.id ) %>
</td>
<td>
<%= link_to image.owner_id, images_url( :owner_id=>image.owner_id ) %>
Modified: incubator/deltacloud/trunk/framework/app/views/images/show.html.erb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/views/images/show.html.erb?rev=962043&r1=962042&r2=962043&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/views/images/show.html.erb (original)
+++ incubator/deltacloud/trunk/framework/app/views/images/show.html.erb Thu Jul 8 23:19:00 2010
@@ -1,6 +1,6 @@
<h1>Image</h1>
-<h2><%= @image.resource_id %></h2>
+<h2><%= @image.id %></h2>
<dl>
<di>
@@ -30,5 +30,5 @@
</dl>
<div>
- <%= link_to 'launch', new_instance_url( :image_id=>@image.resource_id ) %>
+ <%= link_to 'launch', new_instance_url( :image_id=>@image.id ) %>
</div>
Modified: incubator/deltacloud/trunk/framework/app/views/instances/index.html.erb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/views/instances/index.html.erb?rev=962043&r1=962042&r2=962043&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/views/instances/index.html.erb (original)
+++ incubator/deltacloud/trunk/framework/app/views/instances/index.html.erb Thu Jul 8 23:19:00 2010
@@ -24,7 +24,7 @@
<% for instance in @instances %>
<tr>
<td>
- <%= link_to instance.resource_id, instance_url( instance.resource_id ) %>
+ <%= link_to instance.id, instance_url( instance.id ) %>
</td>
<td>
<%= link_to instance.owner_id, images_url( :owner=>instance.owner_id ) %>
@@ -40,7 +40,7 @@
</td>
<td>
<% instance.actions.each do |action| %>
- <%= link_to action, self.send( "#{action}_instance_url", instance.resource_id ), :method=>:post %>
+ <%= link_to action, self.send( "#{action}_instance_url", instance.id ), :method=>:post %>
<% end %>
</td>
</tr>
Modified: incubator/deltacloud/trunk/framework/app/views/instances/new.html.erb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/views/instances/new.html.erb?rev=962043&r1=962042&r2=962043&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/views/instances/new.html.erb (original)
+++ incubator/deltacloud/trunk/framework/app/views/instances/new.html.erb Thu Jul 8 23:19:00 2010
@@ -1,15 +1,15 @@
<h1>New Instance</h1>
-<h2><%= @image.resource_id %></h2>
+<h2><%= @image.id %></h2>
<h3><%= @image.description %></h3>
<% form_tag instances_url do %>
<%= hidden_field_tag :image_id, @instance.image_id %>
<% for flavor in @flavors %>
<div class="radio-group">
- <label for="flavor_id_<%=flavor.resource_id%>">
- <%= radio_button_tag 'flavor_id', flavor.resource_id %>
- <%= flavor.resource_id %><br/>
+ <label for="flavor_id_<%=flavor.id%>">
+ <%= radio_button_tag 'flavor_id', flavor.id %>
+ <%= flavor.id %><br/>
<span class="radio-group-details">
<%= flavor.architecture %>, <%= flavor.memory %> GB, <%= flavor.storage %> GB
</span>
Modified: incubator/deltacloud/trunk/framework/app/views/instances/show.html.erb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/views/instances/show.html.erb?rev=962043&r1=962042&r2=962043&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/views/instances/show.html.erb (original)
+++ incubator/deltacloud/trunk/framework/app/views/instances/show.html.erb Thu Jul 8 23:19:00 2010
@@ -1,5 +1,5 @@
-<h1><%= @instance.resource_id %></h1>
+<h1><%= @instance.id %></h1>
<dl>
<di>
@@ -58,7 +58,7 @@
<div>
<% @instance.actions.each do |action| %>
- <%= link_to action, send( "#{action}_instance_url", @instance.resource_id ), :method=>:post %>
+ <%= link_to action, send( "#{action}_instance_url", @instance.id ), :method=>:post %>
<% end %>
- <%= link_to 'delete', instance_url( @instance.resource_id ), :method=>:delete %>
+ <%= link_to 'delete', instance_url( @instance.id ), :method=>:delete %>
</div>
Modified: incubator/deltacloud/trunk/framework/config/environment.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/config/environment.rb?rev=962043&r1=962042&r2=962043&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/config/environment.rb (original)
+++ incubator/deltacloud/trunk/framework/config/environment.rb Thu Jul 8 23:19:00 2010
@@ -51,8 +51,8 @@ Rails::Initializer.run do |config|
end
-#DRIVER=:ec2
-DRIVER=:mock
+DRIVER=:ec2
+#DRIVER=:mock
DRIVER_ROOT = File.dirname( __FILE__ ) + "/../../deltacloud-driver-#{DRIVER}"
$: << DRIVER_ROOT+'/lib'
Modified: incubator/deltacloud/trunk/framework/lib/converters/xml_converter.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/lib/converters/xml_converter.rb?rev=962043&r1=962042&r2=962043&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/lib/converters/xml_converter.rb (original)
+++ incubator/deltacloud/trunk/framework/lib/converters/xml_converter.rb Thu Jul 8 23:19:00 2010
@@ -36,22 +36,22 @@ module Converters
puts "dump #{obj.inspect} #{obj.is_a?( Flavor )}"
case ( obj )
when Flavor
- builder.flavor( :href=>@link_builder.send( :flavor_url, obj.resource_id ) ) {
- builder.id( obj.resource_id )
+ builder.flavor( :href=>@link_builder.send( :flavor_url, obj.id ) ) {
+ builder.id( obj.id )
builder.architecture( obj.architecture )
builder.memory( obj.memory )
builder.storage( obj.storage )
}
when Image
- builder.image( :href=>@link_builder.send( :image_url, obj.resource_id ) ) {
- builder.id( obj.resource_id )
+ builder.image( :href=>@link_builder.send( :image_url, obj.id ) ) {
+ builder.id( obj.id )
builder.owner_id( obj.owner_id )
builder.description( obj.description )
builder.architecture( obj.architecture )
}
when Instance
- builder.instance( :href=>@link_builder.send( :instance_url, obj.resource_id ) ) {
- builder.id( obj.resource_id )
+ builder.instance( :href=>@link_builder.send( :instance_url, obj.id ) ) {
+ builder.id( obj.id )
builder.owner_id( obj.owner_id )
builder.image( :href=>@link_builder.send( :image_url, obj.image_id ) )
builder.flavor( :href=>@link_builder.send( :flavor_url, obj.flavor_id ) )
@@ -59,7 +59,7 @@ module Converters
builder.actions {
if ( obj.actions )
obj.actions.each do |action|
- builder.link( :rel=>action, :href=>@link_builder.send( "#{action}_instance_url", obj.resource_id ) )
+ builder.link( :rel=>action, :href=>@link_builder.send( "#{action}_instance_url", obj.id ) )
end
end
}
Modified: incubator/deltacloud/trunk/framework/lib/deltacloud/base_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/lib/deltacloud/base_driver.rb?rev=962043&r1=962042&r2=962043&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/lib/deltacloud/base_driver.rb (original)
+++ incubator/deltacloud/trunk/framework/lib/deltacloud/base_driver.rb Thu Jul 8 23:19:00 2010
@@ -45,11 +45,10 @@ module DeltaCloud
return collection if opts.nil?
return collection if opts[attribute].nil?
filter = opts[attribute]
- method = ( attribute == :id ? :resource_id : attribute )
if ( filter.is_a?( Array ) )
- return collection.select{|e| filter.include?( e.send(method) ) }
+ return collection.select{|e| filter.include?( e.send(attribute) ) }
else
- return collection.select{|e| puts e.send( method ) ; filter == e.send(method) }
+ return collection.select{|e| filter == e.send(attribute) }
end
end
end