On 14/05/10 17:50 -0400, Chris Lalancette wrote:
>+  - if @instance.name
>+    %name<
>+      [email protected]
>+  - if @instance.owner_id
>+    %owner_id<
>+      [email protected]_id
>+  - if @instance.image_id
>+    %image{:href => image_url(@instance.image_id)}
>+  - if @instance.realm_id
>+    %realm{:href => realm_url(@instance.realm_id)}
>+  - if @instance.state
>+    %state<
>+      [email protected]
>+  - if @instance.instance_profile
>+    - haml_tag :"hardware-profile", {:href => 
>hardware_profile_url(@instance.instance_profile.id)} do
>+      %id<
>+        [email protected]_profile.id
>+      - @instance.instance_profile.overrides.each do |p, v|
>+        %property{:kind => 'fixed', :name => p, :value => v, :unit => 
>Deltacloud::HardwareProfile::unit(p)}
>+  - if @instance.actions
>+    %actions
>+      - @instance.actions.compact.each do |instance_action|
>+        %link{:rel => instance_action, :method => 
>instance_action_method(instance_action), :href => 
>self.send("#{instance_action}_instance_url", @instance.id)}
>+  - if @instance.public_addresses
>+    %public-addresses
>+      - @instance.public_addresses.each do |address|
>+        %address<
>+          =address
>+  - if @instance.private_addresses
>+    %private-addresses
>+      - @instance.private_addresses.each do |address|
>+        %address<
>+          =address
>   - if driver_has_auth_features?
>     %authentication{ :type => driver_auth_feature_name }
>       - if @instance.authn_feature_failed?

I'm not sure if this extra checking have sense for some fields and if throwing
exception when instance doesn't have assigned image isn't better approach.
Or just add something like:

%image
   - unless @instance.image_id
     %error{:code => '404'}
       "Instance without image / Image not found"

Also this patch will need change to client (check if element exists).

-- Michal

-- 
--------------------------------------------------------
Michal Fojtik, [email protected], +420 532 294 4307
Ruby / Ruby On Rails Developer
Deltacloud API: http://deltacloud.org
--------------------------------------------------------
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to