[PATCH] BZ 802571 fix to previous patch so that list_for_user works

Matt Wagner matt.wagner at redhat.com
Wed Mar 28 20:58:21 UTC 2012


On Wed, Mar 28, 2012 at 03:57:41PM -0400, Tzu-Mainn Chen wrote:
> ---
>  src/app/models/pool.rb |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/src/app/models/pool.rb b/src/app/models/pool.rb
> index 57a6caf..e568599 100644
> --- a/src/app/models/pool.rb
> +++ b/src/app/models/pool.rb
> @@ -101,8 +101,9 @@ class Pool < ActiveRecord::Base
>      max = quota.maximum_running_instances
>      total = quota.running_instances
>      avail = max - total unless max.nil?
> -    failed = (user.nil? || failed_instances.empty? ? failed_instances :
> -              failed_instances.list_for_user(user, Privilege::VIEW))
> +    all_failed = instances.failed
> +    failed = (user.nil? || all_failed.empty? ? all_failed :
> +              all_failed.list_for_user(user, Privilege::VIEW))
>      statistics = {
>        :cloud_providers => instances.includes(:provider_account).collect{|i| i.provider_account}.uniq.count,
>        :deployments => deployments.size,
> @@ -111,7 +112,7 @@ class Pool < ActiveRecord::Base
>        :instances_pending => pending_instances.count,
>        :instances_failed => failed,
>        :instances_failed_visible_count => failed.count,
> -      :instances_failed_count => failed_instances.count,
> +      :instances_failed_count => all_failed.count,
>        :used_quota => quota.running_instances,
>        :quota_percent => number_to_percentage(quota.percentage_used,
>                                               :precision => 0),
> -- 
> 1.7.6.5

ACK, fixes the issue and looks good after a bit of closer scrutiny. This
updates the existing patch, so there's no new BZ.

-- Matt



More information about the aeolus-devel mailing list