deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 43/51] Core: Added capability check if the driver support the state machine
Date Mon, 21 May 2012 10:07:24 GMT
From: Michal Fojtik <mfojtik@redhat.com>


Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 .../lib/deltacloud/collections/instance_states.rb  |    4 ++-
 server/tests/drivers/google/setup.rb               |   38 --------------------
 server/views/instance_states/show.html.haml        |    2 +-
 3 files changed, 4 insertions(+), 40 deletions(-)
 delete mode 100644 server/tests/drivers/google/setup.rb

diff --git a/server/lib/deltacloud/collections/instance_states.rb b/server/lib/deltacloud/collections/instance_states.rb
index 56c1561..6122cca 100644
--- a/server/lib/deltacloud/collections/instance_states.rb
+++ b/server/lib/deltacloud/collections/instance_states.rb
@@ -16,8 +16,10 @@
 module Deltacloud::Collections
   class InstanceStates < Base
 
+    check_capability :for => lambda { |m| !driver.send(m).nil? }
+
     collection :instance_states do
-      operation :index do
+      operation :index, :with_capability => :instance_state_machine do
         control do
           @machine = driver.instance_state_machine
           respond_to do |format|
diff --git a/server/tests/drivers/google/setup.rb b/server/tests/drivers/google/setup.rb
deleted file mode 100644
index 95924e5..0000000
--- a/server/tests/drivers/google/setup.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-ENV['API_DRIVER']   = "google"
-ENV['API_USER']     = 'GOOGK7JXLS6UEYS6AYVO'
-ENV['API_PASSWORD'] = 'QjxUunLgszKhBGn/LISQajGR82CfwvraxA9lqnkg'
-
-require 'vcr'
-
-DeltacloudTestCommon::record!
-
-VCR.config do |c|
-  c.cassette_library_dir = "#{File.dirname(__FILE__)}/fixtures/"
-  c.stub_with :excon
-  c.default_cassette_options = { :record => :new_episodes}
-end
-
-#monkey patch fix for VCR normalisation code:
-#see https://github.com/myronmarston/vcr/issues/4
-#when body is a tempfile, like when creating new blob
-#this method of normalisation fails and excon throws errors
-#(Excon::Errors::SocketError:can't convert Tempfile into String)
-#
-#RELEVANT: https://github.com/myronmarston/vcr/issues/101
-#(will need revisiting when vcr 2 comes along)
-
-module VCR
-  module Normalizers
-    module Body
-
-    private
-    def normalize_body
-     self.body = case body
-          when nil, ''; nil
-          else
-            String.new(body) unless body.is_a?(Tempfile)
-        end
-      end
-    end
-  end
-end
diff --git a/server/views/instance_states/show.html.haml b/server/views/instance_states/show.html.haml
index c81a3c3..252f249 100644
--- a/server/views/instance_states/show.html.haml
+++ b/server/views/instance_states/show.html.haml
@@ -2,7 +2,7 @@
 =subheader "#{driver_symbol}@#{Thread::current[:provider] || ENV['API_PROVIDER'] || 'default'}"
 
 %div{ :'data-role' => :content, :'data-theme' => 'd', :class => 'middle-dialog'}
-  = image_tag api_url_for('instance_states?format=png')
+  %img{ :src => api_url_for('instance_states?format=png') }
 
   %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-theme' => 'a'}
     - @machine.states.each do |state|
-- 
1.7.10.1


Mime
View raw message