[PATCH conductor] BZ786535: display failures for instances
Richard Su
rwsu at redhat.com
Wed Feb 15 20:47:02 UTC 2012
On 02/14/2012 08:32 AM, ifarkas at redhat.com wrote:
> From: Imre Farkas<ifarkas at redhat.com>
>
> https://bugzilla.redhat.com/show_bug.cgi?id=786535
> ---
> src/app/controllers/deployments_controller.rb | 8 ++++++++
> src/app/models/task.rb | 5 +++++
> src/app/stylesheets/layout.scss | 1 +
> src/config/locales/en.yml | 1 +
> 4 files changed, 15 insertions(+), 0 deletions(-)
>
> diff --git a/src/app/controllers/deployments_controller.rb b/src/app/controllers/deployments_controller.rb
> index b858723..e567738 100644
> --- a/src/app/controllers/deployments_controller.rb
> +++ b/src/app/controllers/deployments_controller.rb
> @@ -188,6 +188,14 @@ class DeploymentsController< ApplicationController
> if params[:details_tab]
> @view = @details_tab[:view]
> end
> +
> + failures = []
> + @deployment.instances.each do |instance|
> + last_task = instance.tasks.last
> + failures<< I18n.t('deployments.flash.warning.failure_on_instance', :name => instance.name, :message => last_task.message) if last_task.present?&& last_task.failed?
> + end
> + flash.now[:warning] = failures.to_sentence if failures.any?
> +
> respond_to do |format|
> format.html { render :action => 'show'}
> format.js { render :partial => @details_tab[:view] }
> diff --git a/src/app/models/task.rb b/src/app/models/task.rb
> index 86d966c..3825105 100644
> --- a/src/app/models/task.rb
> +++ b/src/app/models/task.rb
> @@ -143,4 +143,9 @@ class Task< ActiveRecord::Base
> errors.add("time_ended", "Tasks ends before it's started") unless time_ended.nil? or time_started.nil? or time_ended>= time_started
> errors.add("time_started", "Tasks starts before it's created") unless time_started.nil? or created_at.nil? or time_started>= created_at
> end
> +
> + def failed?
> + state == STATE_FAILED
> + end
> +
> end
> diff --git a/src/app/stylesheets/layout.scss b/src/app/stylesheets/layout.scss
> index fa8def9..f40339f 100644
> --- a/src/app/stylesheets/layout.scss
> +++ b/src/app/stylesheets/layout.scss
> @@ -1020,6 +1020,7 @@ Alert Flash -- v.0.0.1 [flash] (flash.scss)
> font-size: 12px;
> padding-left: 8px;
> list-style: none;
> + width: 880px;
>
> li + li{
> margin-top: 6px;
> diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
> index fbacbc0..4e222d7 100644
> --- a/src/config/locales/en.yml
> +++ b/src/config/locales/en.yml
> @@ -256,6 +256,7 @@ en:
> disabled_pool: "Cannot launch a Deployment in this Pool. The pool has been disabled."
> failed_to_launch: "Deployment launch failed!"
> deployable_not_selected: "You need to select deployable"
> + failure_on_instance: "Failure reported on %{name}: %{message}"
> error:
> not_launched: "Some assemblies will not be launched:"
> failed_to_launch_assemblies: "Failed to launch following assemblies:"
The errors from deltacloud are now being displayed after refreshing the
deployment page:
Failure reported on tmpl1/tmpl11: 500 : Cannot run VM. There are no
available running Hosts with sufficient memory in VM's Cluster .,
Failure reported on tmpl1/tmpl10: 500 : Cannot run VM. There are no
available running Hosts with sufficient memory in VM's Cluster .,
Failure reported on tmpl1/tmpl6: 500 : Cannot run VM. There are no
available running Hosts with sufficient memory in VM's Cluster ., and
Failure reported on tmpl1/tmpl5: 500 : Cannot run VM. There are no
available running Hosts with sufficient memory in VM's Cluster
These instances shows "stopped" as the state. Should the state be "failed"?
If not then Ack.
More information about the aeolus-devel
mailing list