From: Jan Provaznik <[email protected]>

https://bugzilla.redhat.com/show_bug.cgi?id=644435

Added proper error message handling when launching an instance.
---
 src/app/controllers/instance_controller.rb |    4 +---
 src/app/views/instance/configure.haml      |    1 +
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/app/controllers/instance_controller.rb 
b/src/app/controllers/instance_controller.rb
index ad90404..6855635 100644
--- a/src/app/controllers/instance_controller.rb
+++ b/src/app/controllers/instance_controller.rb
@@ -97,7 +97,7 @@ class InstanceController < ApplicationController
     require_privilege(Privilege::INSTANCE_MODIFY,
                       Pool.find(@instance.pool_id))
     #FIXME: This should probably be in a transaction
-    if @instance.save!
+    if @instance.save
 
       @task = InstanceTask.new({:user        => current_user,
                                 :task_target => @instance,
@@ -111,8 +111,6 @@ class InstanceController < ApplicationController
         render :action => 'configure'
       end
     else
-      #...@pool = Pool.find(@instance.pool_id)
-      @hardware_profiles = HardwareProfile.all
       render :action => 'configure'
     end
   end
diff --git a/src/app/views/instance/configure.haml 
b/src/app/views/instance/configure.haml
index 20929b4..dd6bce6 100644
--- a/src/app/views/instance/configure.haml
+++ b/src/app/views/instance/configure.haml
@@ -1,4 +1,5 @@
 %h2 Launch instance
+= error_messages_for 'instance'
 - form_for @instance, :url => {:action => 'create'} do
   = hidden_field :instance, :template_id
   = hidden_field :instance, :pool_id
-- 
1.7.2.3

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to