foreman_docker 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -2
  3. data/Rakefile +13 -2
  4. data/app/assets/stylesheets/foreman_docker/terminal.css.scss +85 -0
  5. data/app/controllers/containers/steps_controller.rb +55 -0
  6. data/app/controllers/containers_controller.rb +62 -0
  7. data/app/helpers/container_steps_helper.rb +11 -0
  8. data/app/helpers/containers_helper.rb +54 -0
  9. data/app/models/concerns/fog_extensions/fogdocker/image.rb +1 -2
  10. data/app/models/concerns/fog_extensions/fogdocker/server.rb +18 -8
  11. data/app/models/container.rb +29 -0
  12. data/app/models/docker_image.rb +7 -0
  13. data/app/models/docker_tag.rb +7 -0
  14. data/app/models/foreman_docker/docker.rb +22 -16
  15. data/app/views/api/v1/compute_resources/docker.json +1 -0
  16. data/app/views/api/v2/compute_resources/docker.json +1 -0
  17. data/app/views/compute_resources/form/_docker.html.erb +8 -1
  18. data/app/views/compute_resources_vms/show/_docker.html.erb +4 -0
  19. data/app/views/containers/_list.html.erb +35 -0
  20. data/app/views/containers/index.html.erb +31 -0
  21. data/app/views/containers/show.html.erb +104 -0
  22. data/app/views/containers/steps/_form_buttons.html.erb +20 -0
  23. data/app/views/containers/steps/_title.html.erb +3 -0
  24. data/app/views/containers/steps/configuration.html.erb +14 -0
  25. data/app/views/containers/steps/environment.html.erb +9 -0
  26. data/app/views/containers/steps/image.html.erb +33 -0
  27. data/app/views/containers/steps/preliminary.html.erb +18 -0
  28. data/config/routes.rb +5 -0
  29. data/db/migrate/20140930175337_add_email_to_compute_resource.rb +5 -0
  30. data/db/migrate/20141005233312_create_containers.rb +11 -0
  31. data/db/migrate/20141007225130_add_compute_resource_id_to_container.rb +5 -0
  32. data/db/migrate/20141009001613_add_tag_to_container.rb +5 -0
  33. data/db/migrate/20141009011026_add_attributes_to_container.rb +12 -0
  34. data/db/migrate/20141010173220_create_docker_images.rb +36 -0
  35. data/db/migrate/20141018110810_add_uuid_to_containers.rb +6 -0
  36. data/lib/foreman_docker/engine.rb +38 -6
  37. data/lib/foreman_docker/tasks/test.rake +44 -0
  38. data/lib/foreman_docker/version.rb +1 -1
  39. data/test/factories/compute_resources.rb +15 -0
  40. data/test/factories/containers.rb +6 -0
  41. data/test/factories/docker_image.rb +5 -0
  42. data/test/factories/docker_tag.rb +6 -0
  43. data/test/functionals/container_controller_test.rb +27 -0
  44. data/test/functionals/containers_steps_controller_test.rb +39 -0
  45. data/test/models/container_test.rb +36 -0
  46. data/test/models/docker_image_test.rb +12 -0
  47. data/test/models/docker_tag_test.rb +17 -0
  48. data/test/test_plugin_helper.rb +14 -0
  49. metadata +95 -85
  50. data/lib/tasks/foreman_docker_tasks.rake +0 -4
  51. data/test/dummy/README.rdoc +0 -28
  52. data/test/dummy/Rakefile +0 -6
  53. data/test/dummy/app/assets/javascripts/application.js +0 -13
  54. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  55. data/test/dummy/app/controllers/application_controller.rb +0 -5
  56. data/test/dummy/app/helpers/application_helper.rb +0 -2
  57. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  58. data/test/dummy/bin/bundle +0 -3
  59. data/test/dummy/bin/rails +0 -4
  60. data/test/dummy/bin/rake +0 -4
  61. data/test/dummy/config.ru +0 -4
  62. data/test/dummy/config/application.rb +0 -23
  63. data/test/dummy/config/boot.rb +0 -5
  64. data/test/dummy/config/database.yml +0 -25
  65. data/test/dummy/config/environment.rb +0 -5
  66. data/test/dummy/config/environments/development.rb +0 -29
  67. data/test/dummy/config/environments/production.rb +0 -80
  68. data/test/dummy/config/environments/test.rb +0 -36
  69. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  70. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  71. data/test/dummy/config/initializers/inflections.rb +0 -16
  72. data/test/dummy/config/initializers/mime_types.rb +0 -5
  73. data/test/dummy/config/initializers/secret_token.rb +0 -12
  74. data/test/dummy/config/initializers/session_store.rb +0 -3
  75. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  76. data/test/dummy/config/locales/en.yml +0 -23
  77. data/test/dummy/config/routes.rb +0 -56
  78. data/test/dummy/public/404.html +0 -58
  79. data/test/dummy/public/422.html +0 -58
  80. data/test/dummy/public/500.html +0 -57
  81. data/test/dummy/public/favicon.ico +0 -0
  82. data/test/foreman_docker_test.rb +0 -7
  83. data/test/test_helper.rb +0 -15
@@ -0,0 +1 @@
1
+ attributes :user
@@ -0,0 +1 @@
1
+ attributes :user
@@ -1,4 +1,11 @@
1
1
  <%= text_f f, :url, :size => "col-md-8", :help_block => _("e.g. https://docker.example.com:4243 or unix:///var/run/docker.sock") %>
2
2
  <%= text_f f, :user %>
3
3
  <%= password_f f, :password %>
4
- <%# text_f f, :email %>
4
+ <%= text_f f, :email %>
5
+
6
+ <% client = f.object.client rescue [] %>
7
+ <%= link_to_function _("Test Connection"), "testConnection(this)",
8
+ :class => "btn + #{client.nil? ? "btn-default" : "btn-success"}",
9
+ :'data-url' => test_connection_compute_resources_path %>
10
+
11
+ <%= image_tag('/assets/spinner.gif', :id => 'test_connection_indicator', :class => 'hide') %>
@@ -26,6 +26,10 @@
26
26
  <td><%= _('Command') %></td>
27
27
  <td><%= @vm.command %> </td>
28
28
  </tr>
29
+ <tr>
30
+ <td><%= _('Exposed ports') %></td>
31
+ <td><%= @vm.exposed_ports %> </td>
32
+ </tr>
29
33
 
30
34
  <tr>
31
35
  <td><%= _('Running on') %></td>
@@ -0,0 +1,35 @@
1
+ <table class="table table-bordered table-striped table-condensed" data-table="inline">
2
+ </thead>
3
+ <tr>
4
+ <th class="text-center"><%= sort :name, :as => _("Name") %></th>
5
+ <th class="hidden-tablet hidden-xs text-center"><%= sort :status, :as => _("Status") %></th>
6
+ <th class="hidden-tablet hidden-xs text-center"><%= sort :image, :as => _("Image") %></th>
7
+ <th class="hidden-tablet hidden-xs text-center"><%= sort :command, :as => _("Command") %></th>
8
+ <th class="hidden-tablet hidden-xs text-center"><%= sort :uptime, :as => _("Uptime") %></th>
9
+ <th class="hidden-tablet hidden-xs text-center"><%= sort :running_on, :as => _("Running on") %></th>
10
+ <th class="hidden-tablet hidden-xs text-center"><%= sort :managed , :as => _("Managed") %></th>
11
+ <th></th>
12
+ </tr>
13
+ </thead>
14
+
15
+ <% containers.each do |container| %>
16
+ <tr>
17
+ <td class="ellipsis text-center"><%= link_to_container(container, resource) %></td>
18
+ <td class="hidden-tablet hidden-xs text-center"><span <%= vm_power_class(container.ready?) %>><%= vm_state(container) %></span></td>
19
+ <td class="hidden-tablet hidden-xs text-center"><%= trunc(container.image_friendly_name) %></td>
20
+ <td class="hidden-tablet hidden-xs text-center"><%= trunc(container.command) %></td>
21
+ <td class="hidden-tablet hidden-xs text-center"><span class="glyphicon glyphicon-time"></span> <%= container.ready? ? time_ago_in_words(container.started_at) : "N/A" %></td>
22
+ <td class="hidden-tablet hidden-xs text-center"><%= link_to resource, compute_resource_path(resource)%> </td>
23
+ <td class="hidden-tablet hidden-xs text-center"><%= managed_icon(container, resource) %></td>
24
+ <% @compute_resource = resource %>
25
+ <td><%= action_buttons(vm_power_action(container),
26
+ display_delete_if_authorized(hash_for_container_path(:compute_resource_id => resource,
27
+ :id => container.id).
28
+ merge(:auth_object => resource, :auth_action => 'destroy',
29
+ :authorizer => authorizer),
30
+ :confirm => _("Delete %s?") % container.name)) %></td>
31
+ </tr>
32
+ <% end %>
33
+ </table>
34
+
35
+ <%= will_paginate_with_info containers %>
@@ -0,0 +1,31 @@
1
+ <% title _("Containers") %>
2
+
3
+ <% if authorized? %>
4
+ <% title_actions button_group(link_to_if_authorized _("New container"), hash_for_new_container_path,
5
+ :class => 'btn-success' ) %>
6
+ <% end %>
7
+
8
+ <ul class="nav nav-tabs" data-tabs="tabs">
9
+ <% @container_resources.each_with_index do |resource, i| %>
10
+ <% if i == 0 %>
11
+ <li class="active"><a href="#<%= "primary" %>" data-toggle="tab"><%= _("#{resource.name}") %></a></li>
12
+ <% else %>
13
+ <li><a href="#<%= resource.name %>" data-toggle="tab"><%= _("#{resource.name}") %></a></li>
14
+ <% end %>
15
+ <% end %>
16
+ </ul>
17
+
18
+ <div class="tab-content">
19
+ <% @container_resources.each_with_index do |resource, i| %>
20
+ <% if i == 0 %>
21
+ <div class="tab-pane active" id="primary">
22
+ <% else %>
23
+ <div class="tab-pane" id="<%= resource.name %>">
24
+ <% end %>
25
+ <%= render 'list', :containers => resource.vms.to_a
26
+ .sort_by(&:name).paginate(:page => params[:page],
27
+ :per_page => 10),
28
+ :resource => resource %>
29
+ </div>
30
+ <% end %>
31
+ </div>
@@ -0,0 +1,104 @@
1
+ <% title "#{@container.name.titleize} - #{@container.in_fog.name}" %>
2
+ <%= stylesheet 'foreman_docker/terminal' %>
3
+ <%= container_title_actions(@container) %>
4
+ <div id="host-show" class="row">
5
+ <div class="col-md-4">
6
+ <div id="myTabContent" class="tab-content">
7
+ <div class="tab-pane active in">
8
+ <table id="properties_table" class="table table-bordered table-striped">
9
+ <tr><th colspan="2"><%= _('Properties') %></th></tr>
10
+ <tr>
11
+ <td><%= _('Name') %></td>
12
+ <td><%= @container.in_fog.name %></td>
13
+ </tr>
14
+ <tr>
15
+ <td><%= _('Image') %></td>
16
+ <td><%= @container.image.image_id %> </td>
17
+ </tr>
18
+ <tr>
19
+ <td><%= _('Tag') %></td>
20
+ <td><%= @container.tag.tag %> </td>
21
+ </tr>
22
+ <tr>
23
+ <td><%= _('IP Address') %></td>
24
+ <td><%= @container.in_fog.ipaddress %> </td>
25
+ </tr>
26
+ <tr>
27
+ <td><%= _('CPU shares') %></td>
28
+ <td><%= @container.in_fog.cores %></td>
29
+ </tr>
30
+ <tr>
31
+ <td><%= _('UUID') %></td>
32
+ <td><%= trunc @container.in_fog.identity %></td>
33
+ </tr>
34
+ <tr>
35
+ <td><%= _('Memory') %></td>
36
+ <td><%= number_to_human_size @container.in_fog.memory %> </td>
37
+ </tr>
38
+ <tr>
39
+ <td><%= _('Command') %></td>
40
+ <td><%= @container.in_fog.command %> </td>
41
+ </tr>
42
+ <tr>
43
+ <td><%= _('Exposed ports') %></td>
44
+ <td><%= @container.in_fog.exposed_ports %> </td>
45
+ </tr>
46
+
47
+ <tr>
48
+ <td><%= _('Running on') %></td>
49
+ <td><%= link_to @container.compute_resource,
50
+ compute_resource_path(@container.compute_resource) %></td>
51
+ </tr>
52
+ </tr>
53
+ </table>
54
+ </div>
55
+ </div>
56
+ </div>
57
+ <div class="col-md-8">
58
+ <% if @container.in_fog.ready? %>
59
+ <ul id="myTab" class="nav nav-tabs">
60
+ <li class="active"><a href="#processes" data-toggle="tab">
61
+ <span class="glyphicon glyphicon-credit-card"></span>
62
+ <%= _('Processes') %>
63
+ </a></li>
64
+ <li><a href="#logs" data-toggle="tab">
65
+ <span class="glyphicon glyphicon-list-alt"></span>
66
+ <%= _('Logs') %>
67
+ </a></li>
68
+ </ul>
69
+ <div id="myTabContent" class="tab-content">
70
+ <div class="tab-pane active in" id="processes">
71
+ <% processes = Docker::Container.get(@container.uuid).top %>
72
+ <div class='accordion' id='accordion'>
73
+ <% processes.each do |process| %>
74
+ <div>
75
+ <h2>
76
+ <a href='#<%= process['PID'] %>-index'
77
+ class='accordion-toggle'
78
+ data-toggle='collapse'
79
+ data-parent='#accordion'>
80
+ <%= process['CMD'] %>
81
+ </a><br>
82
+ <small><%= process['UID'] %></small>
83
+ </h2>
84
+ </div>
85
+ <div id='<%= process['PID'] %>-index' class='collapse accordion-body'>
86
+ <pre class="prettyprint"><%= JSON.pretty_generate(process) %></pre>
87
+ </div>
88
+ <% end %>
89
+ </div>
90
+ </div>
91
+ <div class="tab-pane" id="logs">
92
+ <pre class="terminal terminal-output pre-scrollable"><code><%= Docker::Container.get(@container.uuid).logs(:stdout => true, :tail => 100) %></code></pre>
93
+ </div>
94
+ </div>
95
+ <% else %>
96
+ <div class="alert alert-block alert-warning">
97
+ <p><strong><%= _("Notice") %></strong>
98
+ <hr>
99
+ <%= _("Your container is stopped.") %></p>
100
+ <p><%= _("Please turn on your container to see processes running, logs, and more.") %></p>
101
+ </div>
102
+ <% end %>
103
+ </div>
104
+ </div>
@@ -0,0 +1,20 @@
1
+ <div class="clearfix">
2
+ <div class="form-actions">
3
+ <% if step == :preliminary %>
4
+ <%= link_to _("Cancel"), containers_path, :class => "btn btn-danger" %>
5
+ <% else %>
6
+ <a class="btn btn-default" href="<%= previous_wizard_path %>">
7
+ <span class="glyphicon glyphicon-chevron-left"></span>
8
+ <%= _("Back") %>
9
+ </a>
10
+ <% end %>
11
+ <%= button_tag(:type => 'submit', :class => "btn btn-primary pull-right") do %>
12
+ <% if step == :environment %>
13
+ <%= _("Submit") %>
14
+ <% else %>
15
+ <%= _("Next") %>
16
+ <span class="glyphicon glyphicon-chevron-right"></span>
17
+ <% end %>
18
+ <% end %>
19
+ </div>
20
+ </div>
@@ -0,0 +1,3 @@
1
+ <% title _("New container") %>
2
+ <%= container_wizard(step) %>
3
+ <%= yield %>
@@ -0,0 +1,14 @@
1
+ <%= render :layout => 'title', :locals => { :step => 3 } do %>
2
+ <%= form_for @container, :url => wizard_path, :method => :put do |f| %>
3
+ <h3><%= _("Basic options") %></h3>
4
+ <%= text_f f, :name, :size => 'col-md-4' %>
5
+ <%= text_f f, :command, :size => 'col-md-4' %>
6
+ <%= text_f f, :entrypoint, :size => 'col-md-4' %>
7
+ <hr>
8
+ <h3><%= _("Compute options") %></h3>
9
+ <%= selectable_f f, :cpu_set, 1..f.object.compute_resource.max_cpu_count, { }, :class => "col-md-2", :label => _('Cores') %>
10
+ <%= text_f f, :cpu_shares, :class => "col-md-2", :label => _('CPU shares') %>
11
+ <%= selectable_f f, :memory, memory_options(f.object.compute_resource.max_memory), { }, :class => "col-md-2", :label => _('Memory') %>
12
+ <%= render :partial => 'form_buttons' %>
13
+ <% end %>
14
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <%= render :layout => 'title', :locals => { :step => 4 } do %>
2
+ <%= form_for @container, :url => wizard_path, :method => :put do |f| %>
3
+ <%= checkbox_f f, :tty, :help_inline => _('Allocate a pseudo-tty'), :label => _('TTY') %>
4
+ <%= checkbox_f f, :attach_stdin, :label => _('Attach STDIN') %>
5
+ <%= checkbox_f f, :attach_stdout, :label => _('Attach STDOUT') %>
6
+ <%= checkbox_f f, :attach_stderr, :label => _('Attach STDERR') %>
7
+ <%= render :partial => 'form_buttons' %>
8
+ <% end %>
9
+ <% end %>
@@ -0,0 +1,33 @@
1
+ <%= render :layout => 'title', :locals => { :step => 2 } do %>
2
+ <ul class="nav nav-tabs" data-tabs="tabs">
3
+ <li class="active"><a href="#primary" data-toggle="tab">
4
+ <span class="glyphicon glyphicon-cloud-download"></span>
5
+ <%= _("Docker hub") %>
6
+ </a></li>
7
+ <li><a href="#others" data-toggle="tab">
8
+ <span class="glyphicon glyphicon-globe"></span>
9
+ <%= _("Others") %>
10
+ </a></li>
11
+ </ul>
12
+ <div class="tab-content">
13
+ <%= form_for @container, :url => wizard_path, :method => :put do |f| %>
14
+ <div class="tab-pane active" id="primary">
15
+ <div class="input-group col-md-6">
16
+ <%= auto_complete_search(:image, '',
17
+ :path => 'containers_path',
18
+ :value => f.object.image.present? ? f.object.image.image_id : '',
19
+ :placeholder => ('Find your favorite container, e.g: centos:latest')) %>
20
+ <span class="input-group-btn">
21
+ <%= button_tag(:class => 'btn btn-default') do %>
22
+ <span class="glyphicon glyphicon-search"></span>
23
+ <%= _("Search") %>
24
+ <% end %>
25
+ </span>
26
+ </div>
27
+ <hr>
28
+ <%= text_f f, :tag, :value => f.object.tag.present? ? f.object.tag.tag : '', :size => 'col-md-4' %>
29
+ </div>
30
+ <%= render :partial => 'form_buttons' %>
31
+ <% end %>
32
+ </div>
33
+ <% end %>
@@ -0,0 +1,18 @@
1
+ <%= render :layout => 'title', :locals => { :step => 1 } do %>
2
+ <%= form_for @container, :url => wizard_path, :method => :put do |f| %>
3
+ <div>
4
+ <% if @container_resources.present? %>
5
+ <h3><%= _("Resource selection") %></h3>
6
+ <%= _("Where do you want to deploy your container?:") %>
7
+ <hr>
8
+ <%= select_f f, :compute_resource_id, @container_resources, :id, :to_label, {}, { :label => _('Deploy on') } %>
9
+ <% else %>
10
+ <div class="alert alert-warning alert-dismissable">
11
+ <%= image_tag 'false.png' %> <%= (_("You need a Docker compute resource in order to create containers. Please %s and try again.") % link_to('add a new one', hash_for_new_compute_resource_path)).html_safe %>
12
+ </div>
13
+ <% end %>
14
+ </div>
15
+
16
+ <%= render :partial => 'form_buttons' %>
17
+ <% end %>
18
+ <% end %>
@@ -0,0 +1,5 @@
1
+ Rails.application.routes.draw do
2
+ resources :containers, :only => [:index, :new, :show, :destroy] do
3
+ resources :steps, :controller => 'containers/steps', :only => [:show, :update]
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddEmailToComputeResource < ActiveRecord::Migration
2
+ def change
3
+ add_column :compute_resources, :email, :string
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ class CreateContainers < ActiveRecord::Migration
2
+ def change
3
+ create_table :containers do |t|
4
+ t.string :name
5
+ t.string :image
6
+ t.string :command
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ class AddComputeResourceIdToContainer < ActiveRecord::Migration
2
+ def change
3
+ add_column :containers, :compute_resource_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddTagToContainer < ActiveRecord::Migration
2
+ def change
3
+ add_column :containers, :tag, :string
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ class AddAttributesToContainer < ActiveRecord::Migration
2
+ def change
3
+ add_column :containers, :entrypoint, :string
4
+ add_column :containers, :cpu_set, :integer
5
+ add_column :containers, :cpu_shares, :float
6
+ add_column :containers, :memory, :integer
7
+ add_column :containers, :tty, :boolean
8
+ add_column :containers, :attach_stdin, :boolean, :default => true
9
+ add_column :containers, :attach_stdout, :boolean, :default => true
10
+ add_column :containers, :attach_stderr, :boolean, :default => true
11
+ end
12
+ end
@@ -0,0 +1,36 @@
1
+ class CreateDockerImages < ActiveRecord::Migration
2
+ def up
3
+ create_table :docker_images do |t|
4
+ t.string :image_id
5
+ t.integer :size
6
+ t.timestamps
7
+ end
8
+
9
+ create_table :docker_tags do |t|
10
+ t.string :tag
11
+ t.references :docker_image, :null => false
12
+ t.timestamps
13
+ end
14
+ add_foreign_key :docker_tags, :docker_images,
15
+ :column => :docker_image_id
16
+
17
+ remove_column :containers, :image
18
+ remove_column :containers, :tag
19
+ add_column :containers, :docker_image_id, :integer
20
+ add_column :containers, :docker_tag_id, :integer
21
+ add_foreign_key :containers, :docker_images,
22
+ :column => :docker_image_id
23
+ add_foreign_key :containers, :docker_tags,
24
+ :column => :docker_tag_id
25
+ end
26
+
27
+ def down
28
+ drop_table :docker_images
29
+ drop_table :docker_tags
30
+
31
+ add_column :containers, :image, :string
32
+ add_column :containers, :tag, :string
33
+ remove_column :containers, :docker_image_id
34
+ remove_column :containers, :docker_tag_id
35
+ end
36
+ end
@@ -0,0 +1,6 @@
1
+ class AddUuidToContainers < ActiveRecord::Migration
2
+ def change
3
+ add_column :containers, :uuid, :string
4
+ add_index :containers, [:uuid, :compute_resource_id]
5
+ end
6
+ end
@@ -2,28 +2,60 @@ require 'fast_gettext'
2
2
  require 'gettext_i18n_rails'
3
3
  require 'fog'
4
4
  require 'fog/fogdocker'
5
+ require 'wicked'
5
6
 
6
7
  module ForemanDocker
7
- #Inherit from the Rails module of the parent app (Foreman), not the plugin.
8
- #Thus, inherits from ::Rails::Engine and not from Rails::Engine
8
+ # Inherit from the Rails module of the parent app (Foreman), not the plugin.
9
+ # Thus, inherits from ::Rails::Engine and not from Rails::Engine
9
10
  class Engine < ::Rails::Engine
11
+ initializer 'foreman_docker.load_app_instance_data' do |app|
12
+ app.config.paths['db/migrate'] += ForemanDocker::Engine.paths['db/migrate'].existent
13
+ end
14
+
15
+ initializer "foreman_docker.assets.precompile" do |app|
16
+ app.config.assets.precompile += ['foreman_docker/terminal.css']
17
+ end
18
+
19
+ initializer 'foreman_docker.configure_assets', :group => :assets do
20
+ SETTINGS[:foreman_docker_engine] =
21
+ { :assets => { :precompile => ['foreman_docker/terminal.css'] } }
22
+ end
10
23
 
11
- initializer 'foreman_docker.register_gettext', :after => :load_config_initializers do |app|
24
+ initializer 'foreman_docker.register_gettext', :after => :load_config_initializers do
12
25
  locale_dir = File.join(File.expand_path('../../..', __FILE__), 'locale')
13
- locale_domain = 'docker'
26
+ locale_domain = 'foreman_docker'
14
27
 
15
28
  Foreman::Gettext::Support.add_text_domain locale_domain, locale_dir
16
29
  end
17
30
 
18
- initializer 'foreman_docker.register_plugin', :after=> :finisher_hook do |app|
31
+ initializer 'foreman_docker.register_plugin', :after => :finisher_hook do
19
32
  Foreman::Plugin.register :foreman_docker do
20
33
  requires_foreman '> 1.4'
21
- # Register docker compute resource in foreman
22
34
  compute_resource ForemanDocker::Docker
35
+
36
+ sub_menu :top_menu, :containers_menu, :caption => N_('Containers'),
37
+ :after => :monitor_menu do
38
+ menu :top_menu, :containers, :caption => N_('All containers'),
39
+ :url_hash => { :controller => :containers,
40
+ :action => :index }
41
+ menu :top_menu, :new_container, :caption => N_('New container'),
42
+ :url_hash => { :controller => :containers,
43
+ :action => :new }
44
+ end
45
+
46
+ security_block :containers do
47
+ permission :view_containers, :containers => [:index, :show]
48
+ permission :create_containers, :'containers/steps' => [:show, :update],
49
+ :containers => [:new]
50
+ permission :destroy_containers, :containers => [:destroy]
51
+ end
23
52
  end
24
53
 
25
54
  end
26
55
 
56
+ rake_tasks do
57
+ load "#{ForemanDocker::Engine.root}/lib/foreman_docker/tasks/test.rake"
58
+ end
27
59
  end
28
60
 
29
61
  # extend fog docker server and image models.