You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2012/05/22 22:19:37 UTC

[17/50] [abbrv] git commit: Core: Added capability check if the driver support the state machine

Core: Added capability check if the driver support the state machine


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

Branch: refs/heads/master
Commit: 8b0994485e7840bb25477e072e63e6c27a021a31
Parents: f82174d
Author: Michal Fojtik <mf...@redhat.com>
Authored: Thu May 17 12:22:54 2012 +0200
Committer: Michal fojtik <mf...@redhat.com>
Committed: Tue May 22 22:17:38 2012 +0200

----------------------------------------------------------------------
 .../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(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/8b099448/server/lib/deltacloud/collections/instance_states.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|

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/8b099448/server/tests/drivers/google/setup.rb
----------------------------------------------------------------------
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

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/8b099448/server/views/instance_states/show.html.haml
----------------------------------------------------------------------
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|