deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 30/32] Core: Switch to use driver.class.has_feature? instead of driver_has_feature?
Date Tue, 17 Apr 2012 13:40:09 GMT
From: Michal Fojtik <mfojtik@redhat.com>


Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/lib/deltacloud/collections/instances.rb |    3 +++
 server/views/instances/new.html.haml           |   12 ++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/server/lib/deltacloud/collections/instances.rb b/server/lib/deltacloud/collections/instances.rb
index 5202149..0da94f2 100644
--- a/server/lib/deltacloud/collections/instances.rb
+++ b/server/lib/deltacloud/collections/instances.rb
@@ -27,6 +27,9 @@ module Deltacloud::Collections
       @hardware_profiles = driver.hardware_profiles(credentials, :architecture => @image.architecture
)
       @realms = [Realm.new(:id => params[:realm_id])] if params[:realm_id]
       @realms ||= driver.realms(credentials)
+      if driver.class.has_feature? :instances, :authentication_key
+        @keys = driver.keys(credentials)
+      end
     end
 
     collection :instances do
diff --git a/server/views/instances/new.html.haml b/server/views/instances/new.html.haml
index 2347022..5ca775c 100644
--- a/server/views/instances/new.html.haml
+++ b/server/views/instances/new.html.haml
@@ -21,7 +21,7 @@
   %form{ :action => instances_url, :method => :post, :class => :new_instance, :'data-ajax'
=> 'false'}
     %input{ :name => :image_id, :type => :hidden, :value => @instance.image_id }/
 
-    - if driver_has_feature?(:user_name)
+    - if driver.class.has_feature?(:instances, :user_name)
       %div{ 'data-role' => :fieldcontain }
         %label{ :for => :name} Instance name:
         %input{ :type => :text, :id => :name, :name => :name, :value => '' }
@@ -29,19 +29,19 @@
     %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
       %h3 Additional parameters
 
-      - if driver_has_feature?(:user_data)
+      - if driver.class.has_feature?(:instances, :user_data)
         %div{ 'data-role' => :fieldcontain }
           %label{ :for => :user_data} Base64 encoded user-data:
           %textarea{ :id => :user_data, :name => :user_data, :value => '' }
           %br/
           %a{ :href => "", :onclick => 'encodeb64();', :'data-ajax' => 'false'}
Encode data
 
-      - if driver_has_feature?(:instance_count)
+      - if driver.class.has_feature?(:instances, :instance_count)
         %div{ 'data-role' => :fieldcontain }
           %label{ :for => :instance_count} # of instances to be launched:
           %input{ :type => :text, :id => :instance_count, :name => :instance_count,
:value => '1' }
 
-      - if driver_has_feature?(:authentication_key)
+      - if driver.class.has_feature?(:instances, :authentication_key)
         %div{ 'data-role' => :fieldcontain }
           %label{ :for => :keyname, :class => 'ui-input-text'} Instance SSH key:
           %select{:name => 'keyname', :'data-native-menu' => "true" }
@@ -49,7 +49,7 @@
             - @keys.each do |key|
               %option{ :value => key.id } #{key.id}
 
-      - if driver_has_feature?(:register_to_load_balancer)
+      - if driver.class.has_feature?(:instances, :register_to_load_balancer)
         %div{ 'data-role' => :fieldcontain }
           %label{ :for => :load_balancer_id, :class => 'ui-input-text'} Register to
loadbalancer:
           %select{:name => 'load_balancer_id', :'data-native-menu' => "true" }
@@ -57,7 +57,7 @@
             - @load_balancers.each do |load_balancer|
               %option{:value => load_balancer.id} #{load_balancer.id}
 
-      - if driver_has_feature?(:firewalls)
+      - if driver.class.has_feature?(:instances, :firewalls)
         %div{ 'data-role' => :fieldcontain }
           %fieldset{ :'data-role' => 'controlgroup'}
             %legend Register to firewall:
-- 
1.7.10


Mime
View raw message