Project

General

Profile

Revision 387babdd

Added by Daniel Lobato Garcia over 8 years ago

Fixes #8035: Commit container changes

View differences:

app/controllers/containers_controller.rb
1 1
class ContainersController < ::ApplicationController
2
  before_filter :find_resource, :only => [:show, :auto_complete_image, :auto_complete_image_tags]
2
  before_filter :find_resource, :only => [:show, :auto_complete_image, :auto_complete_image_tags,
3
                                          :commit]
3 4

  
4 5
  def index
5 6
    @container_resources = allowed_resources.select { |cr| cr.provider == 'Docker' }
......
54 55
    render :json => images.flatten
55 56
  end
56 57

  
58
  def commit
59
    Docker::Container.get(@container.uuid).commit(:author  => params[:commit][:author],
60
                                                  :repo    => params[:commit][:repo],
61
                                                  :tag     => params[:commit][:tag],
62
                                                  :comment => params[:commit][:comment])
63

  
64
    process_success :success_redirect => :back,
65
                    :success_msg      => _("%{container} commit was successful") %
66
                                         { :container => @container }
67
  rescue => e
68
    process_error :redirect => :back, :error_msg => _("Failed to commit %{container}: %{e}") %
69
                                                    { :container => @container, :e => e }
70
  end
71

  
57 72
  private
58 73

  
59 74
  def action_permission
60 75
    case params[:action]
61 76
    when 'auto_complete_image', 'auto_complete_image_tags'
62
      'view'
77
      :view
78
    when 'commit'
79
      :commit
63 80
    else
64 81
      super
65 82
    end

Also available in: Unified diff