On 06/17/2011 03:30 PM, jprovazn(a)redhat.com wrote:
From: Jan Provaznik<jprovazn(a)redhat.com>
- condormatic_instance_create method moved out of the instance create
transaction
- if an instance's start task has status failed, it's interpreted as an
instances start failure in the UI. This could be simplified by throwing
exceptions in condormatic_instance_create but I don't want to do bigger
changes at this point.
---
src/app/models/deployment.rb | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/app/models/deployment.rb b/src/app/models/deployment.rb
index 9251b36..de2dc63 100644
--- a/src/app/models/deployment.rb
+++ b/src/app/models/deployment.rb
@@ -124,6 +124,7 @@ class Deployment< ActiveRecord::Base
deployable_xml.assemblies.each do |assembly|
# TODO: for now we try to start all instances even if some of them fails
begin
+ task = nil
Instance.transaction do
hw_profile = HardwareProfile.frontend.find_by_name(assembly.hwp)
raise "Hardware Profile #{assembly.hwp} not found." unless
hw_profile
@@ -142,9 +143,13 @@ class Deployment< ActiveRecord::Base
task = InstanceTask.create!({:user => user,
:task_target => instance,
:action =>
InstanceTask::ACTION_CREATE})
- condormatic_instance_create(task)
end
- status[:successes][assembly.name] = 'launched'
+ condormatic_instance_create(task)
+ if task.state == Task::STATE_FAILED
+ status[:errors][assembly.name] = 'failed'
+ else
+ status[:successes][assembly.name] = 'launched'
+ end
rescue
logger.error $!
logger.error $!.backtrace.join("\n ")
NACK. One cuke failed
(scenario: Launch new deployment).
(::) failed steps (::)
expected the following element's content to include "Deployment launched":
Aeolus Conductor
John Smith
My Account
Log out
Close
Failed to launch following assemblies:
backend: failed
frontend: failed
Monitor
Administer
« Return to
Pools
Mockpool
mynewdeployment Deployment
Graphic View
Filter View
Alerts
2
Collapse
mynewdeployment/frontend
Instance Failure
create_failed
mynewdeployment/backend
Instance Failure
create_failed
Instances
mynewdeployment/frontend
Uptime:
00:02:13
IP Address:
State:
create_failed
mynewdeployment/backend
Uptime:
00:01:04
IP Address:
State:
create_failed
Disclaimer
Terms of Use
Support
Copyright © 2011 Red Hat, Inc. All Rights Reserved.
(Spec::Expectations::ExpectationNotMetError)
./features/step_definitions/web_steps.rb:155:in `/^(?:|I )should see
"([^"]*)"$/'
features/deployment.feature:39:in `Then I should see "Deployment launched"'