Class: ContainersController

Inherits:
ApplicationController
  • Object
show all
Includes:
ForemanDocker::FindContainer
Defined in:
app/controllers/containers_controller.rb

Instance Method Summary collapse

Methods included from ForemanDocker::FindContainer

#allowed_resources, #find_container

Instance Method Details

#commitObject



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'app/controllers/containers_controller.rb', line 37

def commit
  Docker::Container.get(@container.uuid).commit(:author  => params[:commit][:author],
                                                :repo    => params[:commit][:repo],
                                                :tag     => params[:commit][:tag],
                                                :comment => params[:commit][:comment])

  process_success :success_redirect => :back,
                  :success_msg      => _("%{container} commit was successful") %
                                       { :container => @container }
rescue => e
  process_error :redirect => :back, :error_msg => _("Failed to commit %{container}: %{e}") %
                                                  { :container => @container, :e => e }
end

#destroyObject



22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/containers_controller.rb', line 22

def destroy
  if container_deletion
    process_success(:success_redirect => containers_path,
                    :success_msg      => (_("Container %s is being deleted.") %
                                          @deleted_identifier))
  else
    process_error(:redirect => containers_path)
  end
rescue ActiveRecord::RecordNotFound
  not_found
end

#indexObject



6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/containers_controller.rb', line 6

def index
  @container_resources = allowed_resources
  if @container_resources.empty?
    warning('You need a Compute Resource of type Docker to start managing containers')
    redirect_to new_compute_resource_path
  end
# This should only rescue Fog::Errors, but Fog returns all kinds of errors...
rescue
  process_error
end

#newObject



17
18
19
20
# File 'app/controllers/containers_controller.rb', line 17

def new
  redirect_to wizard_state_step_path(:wizard_state_id => DockerContainerWizardState.create.id,
                                     :id              => :preliminary)
end

#showObject



34
35
# File 'app/controllers/containers_controller.rb', line 34

def show
end