[PATCH conductor] BZ 797254 - Quick fix for failure to stop/reboot instances

Jan Provaznik jprovazn at redhat.com
Mon Feb 27 10:13:36 UTC 2012


On 02/24/2012 11:03 PM, Matt Wagner wrote:
> Restores from a possible merge conflict.
>
> Should resolve https://bugzilla.redhat.com/show_bug.cgi?id=797254
> ---
>   src/app/controllers/instances_controller.rb |   18 +++++++++++++++---
>   src/config/locales/en.yml                   |    3 ++-
>   2 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/src/app/controllers/instances_controller.rb b/src/app/controllers/instances_controller.rb
> index 987ff9f..ef04cd7 100644
> --- a/src/app/controllers/instances_controller.rb
> +++ b/src/app/controllers/instances_controller.rb
> @@ -16,7 +16,7 @@
>
>   class InstancesController<  ApplicationController
>     before_filter :require_user
> -  before_filter :load_instance, :only =>  [:show, :key, :edit, :update]
> +  before_filter :load_instance, :only =>  [:show, :key, :edit, :update, :stop, :reboot]
>     before_filter :set_view_vars, :only =>  [:show, :index, :export_events]
>     before_filter :check_inaccessible_instances, :only =>  :multi_stop
>
> @@ -176,11 +176,11 @@ class InstancesController<  ApplicationController
>     end
>
>     def stop
> -    do_operation(current_user, :stop)
> +    do_operation(:stop)
>     end
>
>     def reboot
> -    do_operation(current_user, :reboot)
> +    do_operation(:reboot)
>     end
>
>     def multi_reboot
> @@ -262,4 +262,16 @@ class InstancesController<  ApplicationController
>       end
>       return true
>     end
> +
> +  def do_operation(operation)
> +    begin
> +      @instance.send(operation, current_user)
> +      flash[:notice] = t("instances.flash.notice.#{operation}", :name =>  @instance.name)
> +    rescue Exception =>  err
> +      flash[:error] = t("instances.flash.error.#{operation}", :name =>  @instance.name, :err =>  err)
> +    end
> +    respond_to do |format|
> +      format.html { redirect_to deployment_path(@instance.deployment, :details_tab =>  'instances') }
> +    end
> +  end
>   end
> diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
> index 126130c..0def99b 100644
> --- a/src/config/locales/en.yml
> +++ b/src/config/locales/en.yml
> @@ -358,7 +358,8 @@ en:
>           not_deleted:
>             one: "The instance %{list} could not be deleted."
>             other: "The instances %{list} could not be deleted."
> -        not_rebooted: "The instance %{name} was not rebooted because %{err}"
> +        reboot: "The instance %{name} was not rebooted because %{err}"
> +        stop: "The instance %{name} was not stopped because %{err}"
>         success:
>           updated:
>             one: "The instance %{list} was successfully updated."

ACK and pushed. Thanks for quick fix.
(Set of failing test was same as on master.)

Jan



More information about the aeolus-devel mailing list