Project

General

Profile

Download (681 Bytes) Statistics
| Branch: | Tag: | Revision:

foreman_docker / app / controllers / containers_controller.rb @ 466cd5ba

1
class ContainersController < ::ApplicationController
2
  def index
3
    @container_resources = allowed_resources.select { |cr| cr.provider == 'Docker' }
4
    if @container_resources.empty?
5
      warning('You need a Compute Resource of type Docker to start managing containers')
6
      redirect_to new_compute_resource_path
7
    end
8
  # This should only rescue Fog::Errors, but Fog returns all kinds of errors...
9
  rescue
10
    process_error
11
  end
12

    
13
  def new
14
    @container = Container.create
15
    redirect_to container_step_path(:container_id => @container.id, :id => :preliminary)
16
  end
17

    
18
  private
19

    
20
  def allowed_resources
21
    ComputeResource.authorized(:view_compute_resources)
22
  end
23
end